34#pragma GCC system_header
38#ifdef __glibcxx_node_extract
44namespace std _GLIBCXX_VISIBILITY(default)
46_GLIBCXX_BEGIN_NAMESPACE_VERSION
64 template<
typename _Val,
typename _NodeAlloc>
73 get_allocator()
const noexcept
75 __glibcxx_assert(!this->empty());
79 explicit operator bool()
const noexcept {
return _M_ptr !=
nullptr; }
81 [[
nodiscard]]
bool empty()
const noexcept {
return _M_ptr ==
nullptr; }
108 else if (
__nh.empty())
113 _AllocTraits::destroy(*_M_alloc, _M_ptr->_M_valptr());
114 _AllocTraits::deallocate(*_M_alloc, _M_ptr, 1);
116 _M_alloc =
__nh._M_alloc.release();
117 _M_ptr =
__nh._M_ptr;
118 __nh._M_ptr =
nullptr;
127 __glibcxx_assert(
__ptr !=
nullptr);
138 else if (
__nh.empty())
143 swap(_M_ptr,
__nh._M_ptr);
144 _M_alloc.swap(
__nh._M_alloc);
156 _M_ptr =
__nh._M_ptr;
157 __nh._M_ptr =
nullptr;
167 _AllocTraits::destroy(
__alloc, _M_ptr->_M_valptr());
168 _AllocTraits::deallocate(
__alloc, _M_ptr, 1);
183 typename _AllocTraits::pointer _M_ptr;
205 if constexpr (_ATr::propagate_on_container_move_assignment::value)
207 else if constexpr (!_AllocTraits::is_always_equal::value)
208 __glibcxx_assert(_M_alloc ==
__alloc);
216 if constexpr (_AllocTraits::propagate_on_container_swap::value)
217 swap(_M_alloc, __other._M_alloc);
218 else if constexpr (!_AllocTraits::is_always_equal::value)
219 __glibcxx_assert(_M_alloc == __other._M_alloc);
229 _M_alloc.~_NodeAlloc();
240 friend class _Rb_tree;
243 typename _ExtractKey,
typename _Equal,
246 friend class _Hashtable;
252 template<
typename _Key,
typename _Value,
typename _NodeAlloc>
264 using mapped_type =
typename _Value::second_type;
269 __glibcxx_assert(!this->empty());
274 mapped()
const noexcept
276 __glibcxx_assert(!this->empty());
285 swap(_M_pkey,
__nh._M_pkey);
286 swap(_M_pmapped,
__nh._M_pmapped);
291 noexcept(
noexcept(__x.swap(__y)))
304 _M_pkey = _S_pointer_to(
__key);
305 _M_pmapped = _S_pointer_to(
__ptr->_M_valptr()->second);
310 _M_pmapped =
nullptr;
314 template<
typename _Tp>
322 template<
typename _Tp>
324 _S_pointer_to(_Tp&
__obj)
328 _M_key()
const noexcept {
return key(); }
332 friend class _Rb_tree;
335 typename _ExtractKey,
typename _Equal,
338 friend class _Hashtable;
342 template<
typename _Value,
typename _NodeAlloc>
354 using value_type = _Value;
357 value()
const noexcept
359 __glibcxx_assert(!this->empty());
360 return *this->_M_ptr->_M_valptr();
365 { this->_M_swap(
__nh); }
369 noexcept(
noexcept(__x.swap(__y)))
380 _M_key()
const noexcept {
return value(); }
383 typename _Compare,
typename _Alloc>
384 friend class _Rb_tree;
387 typename _ExtractKey,
typename _Equal,
390 friend class _Hashtable;
394 template<
typename _Iterator,
typename _NodeHandle>
397 _Iterator position = _Iterator();
398 bool inserted =
false;
404_GLIBCXX_END_NAMESPACE_VERSION
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
ISO C++ entities toplevel namespace is std.
typename pointer_traits< _Ptr >::template rebind< _Tp > __ptr_rebind
Convenience alias for rebinding pointers.
Base class for node handle types of maps and sets.
Node handle type for maps.
Return type of insert(node_handle&&) on unique maps/sets.