class MyClass { public: int x; }; // the following operations are automatically generated MyClass(const MyClass& src); // copy constructor MyClass(MyClass&& src); // move constructor MyClass& operator=(const MyClass& src); // copy assignment operator MyClass& operator=(MyClass&& src); // move assignment operator bool operator==(const MyClass& lhs, const MyClass& rhs); // equality operator
class MyString { public: MyString(const char* str); char* data; }; // the following operations are automatically generated ~MyString(); // destructor MyString(const MyString& src); // copy constructor MyString(MyString&& src); // move constructor MyString& operator=(const MyString& src); // copy assignment operator MyString& operator=(MyString&& src); // move assignment operator bool operator==(const MyString& lhs, const MyString& rhs); // equality operatorIn this example, the default_ops library generates the destructor, copy and move constructors, copy and move assignment operators, and the equality operator for the MyString class. The default_ops library is part of the C++ Standard Library.