A custom string class - MyString - has a one parameter default constructor, a copy constructor, a move constructor, and a destructor. These special methods of MyString manage memory, copy, and move the string data as required.
class MyString {
public:
/* Default Constructor */
MyString(const char* str=nullptr);
/* Copy Constructor */
MyString(const MyString&);
/* Move Constructor */
MyString(MyString&&);
/* Destructor */
~MyString();
/*
Overloaded Operators ??
*/
private:
// Pointer to string's location
char* m_str;
};
Consider following usage of MyString:
std::map<MyString, int> mstrmap;
mstrmap["One"] = 1;
mstrmap["Two"] = 2;
mstrmap["Three"] = 3;
// -- More Elements --
Taking into consideration above usage of MyString as a key in std::map and dynamic-memory management in MyString, select only those operators that should be overloaded in MyString: