std::string("a")[1] is undefined behavior, regardless of how string is implemented. You'd still technically be indexing outside the string.

Also, phantomotap, what would be wrong with upending the null character onto the string only when c_str() is called?