Код: Выделить всё
struct Foo {
Foo(int x) : x{x} {}
Foo(Foo const&) = delete;
Foo(Foo&&) = delete;
Foo clone() const{
return Foo{x};
}
private:
int x;
};
static_assert(std::is_trivially_copyable_v); // passes
Foo fst{3};
Foo snd = fst.clone();
Но есть ли легитный способ создать копию такого объекта, если нет клонина
Подробнее здесь: https://stackoverflow.com/questions/796 ... ble-fwiw-o