The std::string::operator[] should return char reference:
char& operator[] (size_t pos);
But when I'm passing it to an auto type, it will become a simple char. Why won't it become a char& ?
I have the following code:
std::string str = "Hello";
auto strRef = str[1];
strRef = std::toupper(strRef);
std::cout << "str after:" << str << std::endl;
On the output I will get "Hello" instead of "HEllo".