Implicit move vs copy operations and containment
问题 I am struggling to understand implicit move operations when a class has a member whose move operations were not defined: int main() { struct A // no move: move = copy { A() = default; A(const A&) { cout << "A'copy-ctor\n"; }; A& operator=(const A&) { cout << "A'copy-assign\n"; return *this; } }; struct B { B() = default; A a; // does this make B non-moveable? unique_ptr<int> upi; // B(B&&) noexcept = default; // B& operator=(B&&)noexcept = default; }; A a; A a2 = std::move(a); // ok use copy