Is that true? I thought move ctor enabled move semantics, but if you pass by value the copy ctor was still called (except in places where RVO makes sense). And I thought to disable copying you made the copy ctor = delete.
Is that true? I thought move ctor enabled move semantics, but if you pass by value the copy ctor was still called (except in places where RVO makes sense). And I thought to disable copying you made the copy ctor = delete.
https://en.cppreference.com/w/cpp/language/copy_constructor
But there's no harm in explicitly deleting it, and it helps document the intent.
Perhaps if you were designing C++ from scratch without legacy and had a more Python-like mindset, you'd require an explicit "= default" rather than complicated rules about whether a default is provided for you or not.
So if you define a move constructor and still want your class to have a copy constructor, you'll have to explicitly define the copy constructor, too.
A::A(const A &other) = default;