dimanche 20 août 2017

Differences in c_str function specification between C++ and C++11

In the C++ reference of the c_str() function of the std::string class http://ift.tt/2ihgJBr the following text appears:

Return value
Pointer to the underlying character storage.
data()[i] == operator[](i) for every i in [0, size()) (until C++11)
data() + i == &operator[](i) for every i in [0, size()] (since C++11)

I do not understand the difference between the two, except for the range increase by one element since C++11. Isn't the former statement data()[i] == operator[](i) also true for the latter?

Aucun commentaire:

Enregistrer un commentaire