for optimization purposes I am writing a class in which the copy operator passes the internals of the class by reference.
However I want to be able to write two copy operators, one that accepts const values and can only be called by a const object and a non-const variant that then can call non-const methods.
IE I would like something similar to...
myClass& operator= (const myClass& copy_to, const myClass& copy_from);
myClass& operator= (myClass& copy_to, myClass& copy_from);
However in C++ the copy operator must be non-static and can only accept 1 parameter. How can I ensure that the copy operator accepting a const parameter only be called from a const calling object?
If there are any issues with my question please comment so I may improve*