class X
{
public:
X() = default;
X(X const& other) = default;
X& operator=(X const& other) = default;
X(X&& other) = default;
X& operator=(X&& other) = default;
~X() = default;
};
// Rule of five: When the rule of three deletes the copy constructor or
// assignment operator, the move operators are no longer defined by default.
// If move semantics are desired for the class, they must be specified manually.
class Class {
public:
Class() {}
~Class() { ... } // Custom destructor
Class(const Class& c) { ... } // Custom copy constructor
void operator=(const Class& c) { ... } // Custom assignment operator
Class(Class&& c) { ... } // Custom move constructor
void operator=(Class&& c) { ... } // Custom move assignment operator
private:
some_type* non_copyable_resource = nullptr;
}