return modify( s ); // could this not call the "const" version again?
Not. Recursion is not . It will refer to another overload with the std::string & parameter.
This is because the type of the expression s is equal to std::string & , which corresponds to the type of the parameter of another overloaded function.
To perform a repeat, the argument on the call site must be converted to std::string const & . But in your case, this conversion is not required , since there is an overload that does not require conversion.
Nawaz
source share