I am reading a book about C++ and more precisely about the operator overloading.
The example is the following:
const Array &Array::operator=(cons
As far as I know, assignment operators do not return const references in idiomatic C++. The Standard types do not return const references either.
std::string a, b, c;
(a = b).clear(); // no objection from compiler
All of my custom assignment operators have returned a non-const reference.
When in doubt, check the Standard library. It's not flawless, but it definitely gets basic things like this correct.