Returns a pointer to an array that contains the same sequence of characters as the characters that make up the value of the
basic_string object.
Accessing the value at
data()+size() produces
undefined behavior: There are no guarantees that a null character terminates the character sequence pointed by the value returned by this function. See
basic_string::c_str for a function that provides such guarantee.
A program shall not alter any of the characters in this sequence.
Returns a pointer to an array that contains a null-terminated sequence of characters (i.e., a C-string) representing the current value of the
basic_string object.
This array includes the same sequence of characters that make up the value of the
basic_string object plus an additional terminating null-character (
charT()) at the end.
The pointer returned points to the internal array currently used by the
basic_string object to store the characters that conform its value.
Both
basic_string::data and
basic_string::c_str are synonyms and return the same value.