Le firme dell'operatore std::string::operator[]
sono:Perché restituire un riferimento const per un tipo base? (Std :: string :: operator [])
char& operator[] (size_t pos);
const char& operator[] (size_t pos) const;
Perché la versione const ritorno const char&
, e non solo char
?
Perché in questo modo '& s [i] + i == & s [i + 1]'. –