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.
Loading
Please register or sign in to comment