This is the mail archive of the gcc-cvs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

r238291 - in /trunk/libstdc++-v3: ChangeLog inc...


Author: redi
Date: Wed Jul 13 11:08:37 2016
New Revision: 238291

URL: https://gcc.gnu.org/viewcvs?rev=238291&root=gcc&view=rev
Log:
Add non-const overload of std::string::data()

Also fix confusion between pointer and _CharT*, so that allocators with
fancy pointers work correctly.

	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (_M_c_str):
	New function.
	(_M_disjunct, basic_string(const basic_string&, size_t)): Use data()
	instead of _M_data().
	(basic_string(const basic_string&, size_t, size_t, const _Alloc&)):
	Likewise.
	(append(const basic_string&)): Likewise.
	(append(const basic_string&, size_type, size_type)): Likewise.
	(assign(const basic_string&, size_type, size_type)): Likewise.
	(insert(size_type, const basic_string&)): Likewise.
	(insert(size_type, const basic_string&, size_type, size_type)):
	Likewise.
	(replace(size_type, size_type, const basic_string&, size_type,
	size_type)): Likewise.
	(replace(__const_iterator, __const_iterator, const basic_string&)):
	Likewise.
	(c_str(), data()): Use c_str() instead of _M_data().
	(data()): Add non-const overload as per LWG 2391 and P0272R1.
	(compare(const basic_string&)): Use data() instead of _M_data().
	[!_GLIBCXX_USE_CXX11_ABI] (data()): Add non-const overload.
	* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI] (_M_mutate):
	Pass raw pointers to _S_copy.
	(_M_erase, _M_replace_aux): Pass raw pointers to _S_move and
	_S_assign.
	(find(const _CharT*, size_type, size_type)): Use data instead of
	_M_data().
	* testsuite/21_strings/basic_string/allocator/char/ext_ptr.cc: New.
	* testsuite/21_strings/basic_string/operations/data/char/2.cc: New.
	* testsuite/21_strings/basic_string/operations/data/wchar_t/2.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/ext_ptr.cc
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/2.cc
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/operations/data/wchar_t/2.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/basic_string.h
    trunk/libstdc++-v3/include/bits/basic_string.tcc


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]