In the C++ reference of c_str()
in std::string
the following 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?
c_str()
– Plastiddata()[size()]
is UB. – Outwear