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>
70 using allocator_type = __alloc_rebind<_NodeAlloc, _Val>;
73 get_allocator()
const noexcept
75 __glibcxx_assert(!this->empty());
76 return allocator_type(_M_alloc._M_alloc);
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())
116 _M_alloc = __nh._M_alloc.release();
117 _M_ptr = __nh._M_ptr;
118 __nh._M_ptr =
nullptr;
124 const _NodeAlloc& __alloc)
125 : _M_ptr(__ptr), _M_alloc(__alloc)
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;
166 _NodeAlloc __alloc = _M_alloc.release();
178 union _Optional_alloc
180 _Optional_alloc() { }
181 ~_Optional_alloc() { }
183 _Optional_alloc(_Optional_alloc&&) =
delete;
184 _Optional_alloc& operator=(_Optional_alloc&&) =
delete;
186 _Optional_alloc(
const _NodeAlloc& __alloc) noexcept
192 operator=(_NodeAlloc&& __alloc)
noexcept
195 if constexpr (_ATr::propagate_on_container_move_assignment::value)
197 else if constexpr (!_AllocTraits::is_always_equal::value)
198 __glibcxx_assert(_M_alloc == __alloc);
203 swap(_Optional_alloc& __other)
noexcept
206 if constexpr (_AllocTraits::propagate_on_container_swap::value)
207 swap(_M_alloc, __other._M_alloc);
208 else if constexpr (!_AllocTraits::is_always_equal::value)
209 __glibcxx_assert(_M_alloc == __other._M_alloc);
213 _NodeAlloc&
operator*()
noexcept {
return _M_alloc; }
216 _NodeAlloc release()
noexcept
219 _M_alloc.~_NodeAlloc();
225 [[__no_unique_address__]] _Empty _M_empty;
226 [[__no_unique_address__]] _NodeAlloc _M_alloc;
229 [[__no_unique_address__]] _Optional_alloc _M_alloc;
231 template<
typename _Key2,
typename _Value2,
typename _KeyOfValue,
232 typename _Compare,
typename _ValueAlloc>
233 friend class _Rb_tree;
239 template<
typename _Key,
typename _Value,
typename _NodeAlloc>
250 using key_type = _Key;
251 using mapped_type =
typename _Value::second_type;
256 __glibcxx_assert(!this->empty());
261 mapped()
const noexcept
263 __glibcxx_assert(!this->empty());
272 swap(_M_pkey, __nh._M_pkey);
273 swap(_M_pmapped, __nh._M_pmapped);
278 noexcept(
noexcept(__x.swap(__y)))
285 const _NodeAlloc& __alloc)
290 auto& __key =
const_cast<_Key&
>(__ptr->_M_valptr()->first);
291 _M_pkey = _S_pointer_to(__key);
292 _M_pmapped = _S_pointer_to(__ptr->_M_valptr()->second);
297 _M_pmapped =
nullptr;
301 template<
typename _Tp>
306 __pointer<_Key> _M_pkey =
nullptr;
307 __pointer<typename _Value::second_type> _M_pmapped =
nullptr;
309 template<
typename _Tp>
311 _S_pointer_to(_Tp& __obj)
315 _M_key()
const noexcept {
return key(); }
317 template<
typename _Key2,
typename _Value2,
typename _KeyOfValue,
318 typename _Compare,
typename _ValueAlloc>
319 friend class _Rb_tree;
321 template<
typename _Key2,
typename _Value2,
typename _ValueAlloc,
322 typename _ExtractKey,
typename _Equal,
323 typename _Hash,
typename _RangeHash,
typename _Unused,
324 typename _RehashPolicy,
typename _Traits>
325 friend class _Hashtable;
329 template<
typename _Value,
typename _NodeAlloc>
341 using value_type = _Value;
344 value()
const noexcept
346 __glibcxx_assert(!this->empty());
347 return *this->_M_ptr->_M_valptr();
352 { this->_M_swap(__nh); }
356 noexcept(
noexcept(__x.swap(__y)))
363 const _NodeAlloc& __alloc)
367 _M_key()
const noexcept {
return value(); }
369 template<
typename _Key,
typename _Val,
typename _KeyOfValue,
370 typename _Compare,
typename _Alloc>
371 friend class _Rb_tree;
373 template<
typename _Key2,
typename _Value2,
typename _ValueAlloc,
374 typename _ExtractKey,
typename _Equal,
375 typename _Hash,
typename _RangeHash,
typename _Unused,
376 typename _RehashPolicy,
typename _Traits>
377 friend class _Hashtable;
381 template<
typename _Iterator,
typename _NodeHandle>
384 _Iterator position = _Iterator();
385 bool inserted =
false;
391_GLIBCXX_END_NAMESPACE_VERSION
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
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.
Uniform interface to all allocator types.
__detected_or_t< value_type *, __pointer, _Alloc > pointer
The allocator's pointer type.
static constexpr void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.
static constexpr void destroy(_Alloc &__a, _Tp *__p) noexcept(noexcept(_S_destroy(__a, __p, 0)))
Destroy an object of type _Tp.
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.
Uniform interface to all pointer-like types.