Код: Выделить всё
std::unique_ptr my_unique(nullptr);
if (get_some_pointer(std::out_ptr(my_unique)); my_unique) {
std::cout
Я не могу выяснить, почему это будет проблема. Единственное, что нас волнует, это то, что деструктор std :: out_ptr Код: Выделить всё
#include
struct s {
int i = []() { static int i = 0; return i++; }();
s() { std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79739604/if-with-initializer-lifetime-extension[/url]
Мобильная версия