I am almost sure this has been asked before. Unfortunately, my C++ has become so rusty that I don\'t even know what to search for.
Is there an easy-to-remember rule of t
General rule is that when removing a qualifier produces a different function overload, that qualifier must appear in both places. All other qualifiers stay in the declaration.
The three qualifiers that must appear in both places are const
and the two kinds of reference qualifiers, which appear in the C++11 standard:
void foo() const;
void foo() &;
void foo() &&;
All other qualifiers stay in the declaration.