[PATCH] Add non-const overload of std::string::data()

Jonathan Wakely jwakely@redhat.com
Wed Jul 13 15:57:00 GMT 2016


On 13/07/16 15:59 +0100, Jonathan Wakely wrote:
>On 13/07/16 12:12 +0100, Jonathan Wakely wrote:
>>Also fix confusion between pointer and _CharT*, so that allocators with
>>fancy pointers work correctly.
>>
>>The _M_data() function returns pointer, but we were using it where
>>_CharT* was required. This introduces a new _M_c_str() function which
>>returns a _CharT* instead, and uses that for c_str() and both
>>overloads of data().
>>
>>Most places using _M_data() can just use data() instead, as they only
>>need a const _CharT*. A few need to use _M_c_str() to get _CharT* so
>>they can write to it (they could use the new data() overload, except
>>that it's not defined until C++17).
>>
>>Tested x86_64-linux, committed to trunk.
>>
>>	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (_M_c_str):
>>	New function.
>
>I forgot to add the new exports to the commit, new patch coming
>shortly...

I'm reverting that change for now. We need to regenerate baseline
symbols files before we can bump the shared lib version and add new
symbols.




More information about the Libstdc++ mailing list