According to the c++11 standard a default move constructor is only generated if:
- X does not have a user-declared copy constructor, and
- X does not have a user-declared copy assignment operator,
- X does not have a user-declared move assignment operator,
- X does not have a user-declared destructor, and
- the move constructor would not be implicitly defined as deleted.
Can I still explicitly default it? Seems to work correctly in clang. Like this for example:
class MyClass {
private:
std::vector<int> ints;
public:
MyClass(MyClass const& other) : ints(other.ints) {}
MyClass(MyClass&& other) = default;
};