Skip to content
Snippets Groups Projects
Commit 405a4140 authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

libstdc++: Split std::basic_string::_M_use_local_data into two functions

This splits out the activate-the-union-member-for-constexpr logic from
_M_use_local_data, so that it can be used separately in cases that don't
need to use std::pointer_traits<pointer>::pointer_to to obtain the
return value.

This leaves only three uses of _M_use_local_data() which are all of the
same form:

  __s._M_data(_M_use_local_data());
  __s._M_set_length(0);

We could remove _M_use_local_data() and change those three places to use
a new _M_reset() function that does:

  _M_init_local_buf();
  _M_data(_M_local_data());
  _M_set_length(0);

This is left for a future change.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (_M_init_local_buf()): New
	function.
	(_M_use_local_data()): Use _M_init_local_buf.
	(basic_string(), basic_string(const Alloc&))
	(basic_string(basic_string&&))
	(basic_string(basic_string&&, const Alloc&)): Use
	_M_init_local_buf instead of _M_use_local_data().
	* include/bits/basic_string.tcc (swap(basic_string&))
	(_M_construct(InIter, InIter, input_iterator_tag))
	(_M_construct(InIter, InIter, forward_iterator_tag))
	(_M_construct(size_type, CharT), reserve()): Likewise.
parent be34a8b5
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment