34#pragma GCC system_header
36#if __cplusplus >= 201703L
37# define __cpp_lib_node_extract 201606L
43namespace std _GLIBCXX_VISIBILITY(default)
45_GLIBCXX_BEGIN_NAMESPACE_VERSION
63 template<
typename _Val,
typename _NodeAlloc>
72 get_allocator()
const noexcept
74 __glibcxx_assert(!this->empty());
78 explicit operator bool()
const noexcept {
return _M_ptr !=
nullptr; }
80 [[
nodiscard]]
bool empty()
const noexcept {
return _M_ptr ==
nullptr; }
107 else if (
__nh.empty())
112 _AllocTraits::destroy(*_M_alloc, _M_ptr->_M_valptr());
113 _AllocTraits::deallocate(*_M_alloc, _M_ptr, 1);
115 _M_alloc =
__nh._M_alloc.release();
116 _M_ptr =
__nh._M_ptr;
117 __nh._M_ptr =
nullptr;
126 __glibcxx_assert(
__ptr !=
nullptr);
137 else if (
__nh.empty())
143 _M_alloc.swap(
__nh._M_alloc);
155 _M_ptr =
__nh._M_ptr;
156 __nh._M_ptr =
nullptr;
166 _AllocTraits::destroy(
__alloc, _M_ptr->_M_valptr());
167 _AllocTraits::deallocate(
__alloc, _M_ptr, 1);
182 typename _AllocTraits::pointer _M_ptr;
204 if constexpr (_ATr::propagate_on_container_move_assignment::value)
206 else if constexpr (!_AllocTraits::is_always_equal::value)
207 __glibcxx_assert(_M_alloc ==
__alloc);
215 if constexpr (_AllocTraits::propagate_on_container_swap::value)
216 swap(_M_alloc, __other._M_alloc);
217 else if constexpr (!_AllocTraits::is_always_equal::value)
218 __glibcxx_assert(_M_alloc == __other._M_alloc);
228 _M_alloc.~_NodeAlloc();
239 friend class _Rb_tree;
242 typename _ExtractKey,
typename _Equal,
245 friend class _Hashtable;
251 template<
typename _Key,
typename _Value,
typename _NodeAlloc>
263 using mapped_type =
typename _Value::second_type;
268 __glibcxx_assert(!this->empty());
273 mapped()
const noexcept
275 __glibcxx_assert(!this->empty());
284 swap(_M_pkey,
__nh._M_pkey);
285 swap(_M_pmapped,
__nh._M_pmapped);
290 noexcept(
noexcept(__x.swap(__y)))
303 _M_pkey = _S_pointer_to(
__key);
304 _M_pmapped = _S_pointer_to(
__ptr->_M_valptr()->second);
309 _M_pmapped =
nullptr;
313 template<
typename _Tp>
321 template<
typename _Tp>
323 _S_pointer_to(_Tp&
__obj)
327 _M_key()
const noexcept {
return key(); }
331 friend class _Rb_tree;
334 typename _ExtractKey,
typename _Equal,
337 friend class _Hashtable;
341 template<
typename _Value,
typename _NodeAlloc>
353 using value_type = _Value;
356 value()
const noexcept
358 __glibcxx_assert(!this->empty());
359 return *this->_M_ptr->_M_valptr();
364 { this->_M_swap(
__nh); }
368 noexcept(
noexcept(__x.swap(__y)))
379 _M_key()
const noexcept {
return value(); }
382 typename _Compare,
typename _Alloc>
383 friend class _Rb_tree;
386 typename _ExtractKey,
typename _Equal,
389 friend class _Hashtable;
393 template<
typename _Iterator,
typename _NodeHandle>
396 _Iterator position = _Iterator();
397 bool inserted =
false;
403_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.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
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.