libstdc++
GNU C++ library
Loading...
Searching...
No Matches

◆ basic_string() [24/28]

template<typename _CharT, typename _Traits, typename _Alloc>
std::basic_string< _CharT, _Traits, _Alloc >::basic_string ( basic_string< _CharT, _Traits, _Alloc > && __str)
inlinenoexcept

Move construct string.

Parameters
__strSource string.

The newly-created string contains the exact contents of __str. __str is a valid, but unspecified string.

Definition at line 624 of file cow_string.h.

626 {
627#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
628 // Make __str use the shared empty string rep.
630#else
631 // Rather than allocate an empty string for the rvalue string,
632 // just share ownership with it by incrementing the reference count.
633 // If the rvalue string was the unique owner then there are exactly
634 // two owners now.
635 if (_M_rep()->_M_is_shared())
637 else
638 _M_rep()->_M_refcount = 1;
639#endif
640 }
void __atomic_add_dispatch(_Atomic_word *__mem, int __val)
Definition atomicity.h:149
_Alloc_hider _M_dataplus
constexpr void _M_data(pointer __p)
static _Rep & _S_empty_rep() noexcept
Definition cow_string.h:467
_Rep * _M_rep() const noexcept
Definition cow_string.h:337
Managing sequences of characters and character-like objects.