title: Why did C++11 make std::string::data() add a null terminating character?
body: <p>Previously that was <code>std::string::c_str()</code>'s job, but as of C++11, <code>data()</code> also provides it, why was <code>c_str()</code>'s null-terminating-character added to <code>std::string::data()</code>? To me it seems like a waste of CPU cycles, in cases where the null-terminating-character is not relevant at all and only <code>data()</code> is used, a C++03 compiler doesn't have to care about the terminator, and don't have to write 0 to the terminator every time the string is resized, but a C++11 compiler, because of the <code>data()</code>-null-guarantee, has to waste cycles writing 0 every time the string is resized, so since it potentially makes code slower, I guess they had some reason to add that guarantee, what was it?</p>