Returns a char* pointing to the beginning of a string's internal buffer. The result is a valid "null-terminated byte string", even if *str is empty. Up to C++14 it is not valid to *write* to the null terminator; as of C++17, it is valid to write zero to the null terminator (but not any other value).
| 37 | // Up to C++14 it is not valid to *write* to the null terminator; as of C++17, |
| 38 | // it is valid to write zero to the null terminator (but not any other value). |
| 39 | inline char* string_as_array(string* str) { return &*str->begin(); } |
| 40 | |
| 41 | // The following vector_as_array functions return raw pointers to the underlying |
| 42 | // data buffer. The return value is unspecified (but valid) if the input range |