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

◆ _M_is_shared()

template<typename _CharT, typename _Traits, typename _Alloc>
bool std::basic_string< _CharT, _Traits, _Alloc >::_Rep::_M_is_shared ( ) const
inlinenoexcept

Definition at line 213 of file cow_string.h.

214 {
215#if defined(__GTHREADS)
216 // _M_refcount is mutated concurrently by _M_refcopy/_M_dispose,
217 // so we need to use an atomic load. Another thread can drop last
218 // but one reference concurrently with this check, so we need this
219 // load to be acquire to synchronize with release fetch_and_add in
220 // _M_dispose.
222 return __atomic_load_n(&this->_M_refcount, __ATOMIC_ACQUIRE) > 0;
223#endif
224 return this->_M_refcount > 0;
225 }
Managing sequences of characters and character-like objects.

References __gnu_cxx::__is_single_threaded(), and std::basic_string< _CharT, _Traits, _Alloc >::_Rep_base::_M_refcount.

Here is the call graph for this function: