30#ifndef _FORWARD_LIST_H
31#define _FORWARD_LIST_H 1
34#pragma GCC system_header
49#if __glibcxx_ranges_to_container
54#if ! defined _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
55# define _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 1
58namespace std _GLIBCXX_VISIBILITY(default)
60_GLIBCXX_BEGIN_NAMESPACE_VERSION
61_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
75 : _M_next(__x._M_next)
76 { __x._M_next =
nullptr; }
84 _M_next = __x._M_next;
85 __x._M_next =
nullptr;
98 __begin->_M_next = __end->_M_next;
99 __end->_M_next = _M_next;
102 __begin->_M_next =
nullptr;
108 _M_reverse_after()
noexcept
117 __tail->_M_next = __temp->_M_next;
118 _M_next->_M_next = __keep;
132 template<
typename _Tp>
140 __gnu_cxx::__aligned_buffer<_Tp> _M_storage;
144 {
return _M_storage._M_ptr(); }
147 _M_valptr()
const noexcept
148 {
return _M_storage._M_ptr(); }
162 template<
typename _Tp>
168 typedef _Tp value_type;
169 typedef _Tp* pointer;
170 typedef _Tp& reference;
171 typedef ptrdiff_t difference_type;
183 operator*()
const noexcept
184 {
return *
static_cast<_Node*
>(this->_M_node)->_M_valptr(); }
188 operator->()
const noexcept
189 {
return static_cast<_Node*
>(this->_M_node)->_M_valptr(); }
192 operator++()
noexcept
194 _M_node = _M_node->_M_next;
199 operator++(
int)
noexcept
202 _M_node = _M_node->_M_next;
212 {
return __x._M_node == __y._M_node; }
214#if __cpp_impl_three_way_comparison < 201907L
220 operator!=(
const _Self& __x,
const _Self& __y)
noexcept
221 {
return __x._M_node != __y._M_node; }
225 template<
typename,
typename>
226 friend class forward_list;
227 template<
typename,
typename>
228 friend struct _Fwd_list_base;
229 friend struct _Fwd_list_const_iterator<_Tp>;
232 _M_next() const noexcept
235 return _Fwd_list_iterator(_M_node->_M_next);
237 return _Fwd_list_iterator(
nullptr);
240 _Fwd_list_node_base* _M_node;
248 template<
typename _Tp>
255 typedef _Tp value_type;
256 typedef const _Tp* pointer;
257 typedef const _Tp& reference;
258 typedef ptrdiff_t difference_type;
269 : _M_node(__iter._M_node) { }
273 operator*()
const noexcept
274 {
return *
static_cast<_Node*
>(this->_M_node)->_M_valptr(); }
278 operator->()
const noexcept
279 {
return static_cast<_Node*
>(this->_M_node)->_M_valptr(); }
282 operator++()
noexcept
284 _M_node = _M_node->_M_next;
289 operator++(
int)
noexcept
292 _M_node = _M_node->_M_next;
302 {
return __x._M_node == __y._M_node; }
304#if __cpp_impl_three_way_comparison < 201907L
310 operator!=(
const _Self& __x,
const _Self& __y)
noexcept
311 {
return __x._M_node != __y._M_node; }
315 template<
typename,
typename>
316 friend class forward_list;
317 template<
typename,
typename>
318 friend struct _Fwd_list_base;
321 _M_next() const noexcept
324 return _Fwd_list_const_iterator(_M_node->_M_next);
326 return _Fwd_list_const_iterator(
nullptr);
329 _Fwd_list_iterator<_Tp>
330 _M_const_cast() const noexcept
332 return _Fwd_list_iterator<_Tp>(
333 const_cast<_Fwd_list_node_base*
>(_M_node));
336 const _Fwd_list_node_base* _M_node;
339 template<
typename _Tp,
typename _Allocator>
class forward_list;
340 template<
typename _Tp,
typename _Allocator>
struct _Fwd_list_base;
344#if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
346 template<
typename _Vo
idPtr>
349 using _Base_ptr = __ptr_rebind<_VoidPtr, _Node_base>;
351 _Node_base() =
default;
353 _Node_base(_Node_base&& __x) noexcept
354 : _M_next(__x._M_next)
355 { __x._M_next =
nullptr; }
357 _Node_base(
const _Node_base&) =
delete;
358 _Node_base& operator=(
const _Node_base&) =
delete;
361 operator=(_Node_base&& __x)
noexcept
363 _M_next = __x._M_next;
364 __x._M_next =
nullptr;
368 _Base_ptr _M_next =
nullptr;
372 _M_transfer_after(_Base_ptr __begin, _Base_ptr __end)
noexcept
374 _Base_ptr __keep = __begin->_M_next;
377 __begin->_M_next = __end->_M_next;
378 __end->_M_next = _M_next;
381 __begin->_M_next =
nullptr;
387 _M_reverse_after() noexcept
389 _Base_ptr __tail = _M_next;
392 while (_Base_ptr __temp = __tail->_M_next)
394 _Base_ptr __keep = _M_next;
396 __tail->_M_next = __temp->_M_next;
397 _M_next->_M_next = __keep;
408 return pointer_traits<_Base_ptr>::
409 pointer_to(
const_cast<_Node_base&
>(*
this));
416 template<
typename _ValPtr>
418 :
public _Node_base<__ptr_rebind<_ValPtr, void>>
420 using value_type =
typename pointer_traits<_ValPtr>::element_type;
421 using _Node_ptr = __ptr_rebind<_ValPtr, _Node>;
425 _Node(_Node&&) =
delete;
428#if ! _GLIBCXX_INLINE_VERSION
430 alignas(__alignof__(value_type))
440 _M_valptr() const noexcept
445 {
return pointer_traits<_Node_ptr>::pointer_to(*
this); }
449 template<
bool _Const,
typename _Ptr>
452 using _Node = __fwdlist::_Node<_Ptr>;
454 =
typename __fwdlist::_Node_base<__ptr_rebind<_Ptr, void>>::_Base_ptr;
456 template<
typename _Tp>
457 using __maybe_const = __conditional_t<_Const, const _Tp, _Tp>;
460 using value_type =
typename pointer_traits<_Ptr>::element_type;
461 using difference_type = ptrdiff_t;
462 using iterator_category = forward_iterator_tag;
463 using pointer = __maybe_const<value_type>*;
464 using reference = __maybe_const<value_type>&;
466 constexpr _Iterator() noexcept : _M_node() { }
468 _Iterator(
const _Iterator&) =
default;
469 _Iterator& operator=(
const _Iterator&) =
default;
471#ifdef __glibcxx_concepts
473 _Iterator(
const _Iterator<false, _Ptr>& __i)
requires _Const
475 template<
bool _OtherConst,
476 typename = __enable_if_t<_Const && !_OtherConst>>
478 _Iterator(
const _Iterator<_OtherConst, _Ptr>& __i)
480 : _M_node(__i._M_node) { }
483 _Iterator(_Base_ptr __x) noexcept
489 {
return static_cast<_Node&
>(*this->_M_node)._M_data; }
493 operator->() const noexcept
494 {
return static_cast<_Node&
>(*this->_M_node)._M_valptr(); }
496 _GLIBCXX14_CONSTEXPR _Iterator&
497 operator++() noexcept
499 _M_node = _M_node->_M_next;
503 _GLIBCXX14_CONSTEXPR _Iterator
504 operator++(
int)
noexcept
506 _Iterator __tmp(*
this);
507 _M_node = _M_node->_M_next;
515 friend constexpr bool
516 operator==(
const _Iterator& __x,
const _Iterator& __y)
noexcept
517 {
return __x._M_node == __y._M_node; }
519#if __cpp_impl_three_way_comparison < 201907L
524 friend constexpr bool
525 operator!=(
const _Iterator& __x,
const _Iterator& __y)
noexcept
526 {
return __x._M_node != __y._M_node; }
530 template<
typename _Tp,
typename _Allocator>
531 friend class _GLIBCXX_STD_C::forward_list;
532 template<
typename _Tp,
typename _Allocator>
533 friend struct _GLIBCXX_STD_C::_Fwd_list_base;
535 constexpr _Iterator<false, _Ptr>
536 _M_const_cast() const noexcept
537 {
return _Iterator<false, _Ptr>(_M_node); }
539 friend _Iterator<!_Const, _Ptr>;
542 _M_next() const noexcept
543 {
return _Iterator(_M_node ? _M_node->_M_next : nullptr); }
550 template<
typename _Tp,
typename _Ptr>
553#if _GLIBCXX_USE_ALLOC_PTR_FOR_LIST <= 9000
557 template<
typename _Tp>
558 struct _Node_traits<_Tp, _Tp*>
560 using _Node_base = _Fwd_list_node_base;
561 using _Node = _Fwd_list_node<_Tp>;
562 using _Iterator = _Fwd_list_iterator<_Tp>;
563 using _Const_iterator = _Fwd_list_const_iterator<_Tp>;
567#if ! _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
569 template<
typename _Tp,
typename _Ptr>
571 : _Node_traits<_Tp, _Tp*>
575 template<
typename _Tp,
typename _Ptr>
579 using _VoidPtr = __ptr_rebind<_Ptr, void>;
580 using _ValPtr = __ptr_rebind<_Ptr, _Tp>;
583 using _Node_base = __fwdlist::_Node_base<_VoidPtr>;
584 using _Node = __fwdlist::_Node<_ValPtr>;
585 using _Iterator = __fwdlist::_Iterator<false, _ValPtr>;
586 using _Const_iterator = __fwdlist::_Iterator<true, _ValPtr>;
594 template<
typename _Tp,
typename _Alloc>
597#if __cplusplus > 201703L || defined __STRICT_ANSI__
601 using _Tp_alloc_traits
603 using pointer =
typename _Tp_alloc_traits::pointer;
607 using _Node_traits = __fwdlist::_Node_traits<_Tp, pointer>;
608 using _Node =
typename _Node_traits::_Node;
609 using _Node_alloc_type = __alloc_rebind<_Alloc, _Node>;
611 using _Node_ptr =
typename _Node_alloc_traits::pointer;
612 using _Base_ptr =
typename _Node_traits::_Node_base::_Base_ptr;
614 struct _Fwd_list_impl
615 :
public _Node_alloc_type
617 typename _Node_traits::_Node_base _M_head;
621 : _Node_alloc_type(), _M_head()
624 _Fwd_list_impl(_Fwd_list_impl&&) =
default;
626 _Fwd_list_impl(_Fwd_list_impl&& __fl, _Node_alloc_type&& __a)
630 _Fwd_list_impl(_Node_alloc_type&& __a)
631 : _Node_alloc_type(
std::move(__a)), _M_head()
635 _Fwd_list_impl _M_impl;
638 using iterator =
typename _Node_traits::_Iterator;
639 using const_iterator =
typename _Node_traits::_Const_iterator;
642 _M_get_Node_allocator()
noexcept
643 {
return this->_M_impl; }
645 const _Node_alloc_type&
646 _M_get_Node_allocator()
const noexcept
647 {
return this->_M_impl; }
666 { _M_erase_after(_M_impl._M_head._M_base_ptr(),
nullptr); }
669#if ! _GLIBCXX_INLINE_VERSION
675 return std::__to_address(__ptr);
680 _M_put_node(_Node_ptr __p)
682#if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
685 typedef typename _Node_alloc_traits::pointer _Ptr;
691 template<
typename... _Args>
693 _M_create_node(_Args&&... __args)
695 auto& __alloc = _M_get_Node_allocator();
696 auto __guard = std::__allocate_guarded_obj(__alloc);
697 _Node_alloc_traits::construct(__alloc, __guard->_M_valptr(),
698 std::forward<_Args>(__args)...);
699 auto __p = __guard.release();
700#if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
703 return std::__to_address(__p);
707#pragma GCC diagnostic push
708#pragma GCC diagnostic ignored "-Wc++17-extensions"
710 _M_destroy_node(_Node_ptr __p)
712 auto& __alloc = _M_get_Node_allocator();
714 _Node_alloc_traits::destroy(__alloc, __p->_M_valptr());
720#pragma GCC diagnostic pop
722 template<
typename... _Args>
724 _M_insert_after(const_iterator __pos, _Args&&... __args);
727 _M_erase_after(_Base_ptr __pos);
730 _M_erase_after(_Base_ptr __pos, _Base_ptr __last);
761 template<
typename _Tp,
typename _Alloc = allocator<_Tp>>
765 "std::forward_list must have a non-const, non-volatile value_type");
766#if __cplusplus > 201703L || defined __STRICT_ANSI__
768 "std::forward_list must have the same value_type as its allocator");
774 typedef typename _Base::_Node _Node;
775 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
781 typedef _Tp value_type;
782 typedef typename _Alloc_traits::pointer pointer;
783 typedef typename _Alloc_traits::const_pointer const_pointer;
784 typedef value_type& reference;
785 typedef const value_type& const_reference;
787 typedef typename _Base::iterator iterator;
788 typedef typename _Base::const_iterator const_iterator;
789 typedef std::size_t size_type;
790 typedef std::ptrdiff_t difference_type;
791 typedef _Alloc allocator_type;
806 :
_Base(_Node_alloc_type(__al))
815 const __type_identity_t<_Alloc>& __al)
816 :
_Base(_Node_alloc_type(__al))
817 { _M_range_initialize(__list.
begin(), __list.
end()); }
827 std::__make_move_if_noexcept_iterator(__list.begin()),
828 std::__make_move_if_noexcept_iterator(__list.end()));
844 const __type_identity_t<_Alloc>& __al)
845 noexcept(_Node_alloc_traits::_S_always_equal())
860 :
_Base(_Node_alloc_type(__al))
861 { _M_default_initialize(__n); }
873 const _Alloc& __al = _Alloc())
874 :
_Base(_Node_alloc_type(__al))
875 { _M_fill_initialize(__n, __value); }
887 template<
typename _InputIterator,
888 typename = std::_RequireInputIter<_InputIterator>>
890 const _Alloc& __al = _Alloc())
891 :
_Base(_Node_alloc_type(__al))
892 { _M_range_initialize(__first, __last); }
894#if __glibcxx_ranges_to_container
903 template<__detail::__container_compatible_range<_Tp> _Rg>
904 forward_list(from_range_t, _Rg&& __rg,
const _Alloc& __a = _Alloc())
905 : _Base(_Node_alloc_type(__a))
907 auto __to = this->_M_impl._M_head._M_base_ptr();
908 auto __first = ranges::begin(__rg);
909 const auto __last = ranges::end(__rg);
910 for (; __first != __last; ++__first)
912 __to->_M_next = this->_M_create_node(*__first)->_M_base_ptr();
913 __to = __to->_M_next;
925 __list._M_get_Node_allocator()))
926 { _M_range_initialize(__list.
begin(), __list.
end()); }
948 const _Alloc& __al = _Alloc())
949 :
_Base(_Node_alloc_type(__al))
950 { _M_range_initialize(__il.begin(), __il.end()); }
970#pragma GCC diagnostic push
971#pragma GCC diagnostic ignored "-Wc++17-extensions"
986 noexcept(_Node_alloc_traits::_S_nothrow_move())
988 constexpr bool __move_storage =
989 _Node_alloc_traits::_S_propagate_on_move_assign()
990 || _Node_alloc_traits::_S_always_equal();
991 if constexpr (!__move_storage)
993 if (__list._M_get_Node_allocator() != this->_M_get_Node_allocator())
997 this->
assign(std::make_move_iterator(__list.begin()),
998 std::make_move_iterator(__list.end()));
1004 this->_M_impl._M_head._M_next = __list._M_impl._M_head._M_next;
1005 __list._M_impl._M_head._M_next =
nullptr;
1006 if constexpr (_Node_alloc_traits::_S_propagate_on_move_assign())
1007 this->_M_get_Node_allocator()
1008 =
std::move(__list._M_get_Node_allocator());
1039 template<
typename _InputIterator,
1040 typename = std::_RequireInputIter<_InputIterator>>
1042 assign(_InputIterator __first, _InputIterator __last)
1044 if constexpr (
is_assignable<_Tp,
decltype(*__first)>::value)
1047 auto __curr =
begin();
1049 while (__curr != __end && __first != __last)
1056 if (__first != __last)
1058 else if (__curr != __end)
1067#pragma GCC diagnostic pop
1069#if __glibcxx_ranges_to_container
1074 template<__detail::__container_compatible_range<_Tp> _Rg>
1076 assign_range(_Rg&& __rg)
1078 static_assert(assignable_from<_Tp&, ranges::range_reference_t<_Rg>>);
1080 auto __first = ranges::begin(__rg);
1081 const auto __last = ranges::end(__rg);
1086 while (__curr != __end && __first != __last)
1094 if (__curr != __end)
1097 insert_range_after(__prev,
1098 ranges::subrange(
std::move(__first), __last));
1102#pragma GCC diagnostic push
1103#pragma GCC diagnostic ignored "-Wc++17-extensions"
1120 auto __curr =
begin();
1122 while (__curr != __end && __n > 0)
1131 else if (__curr != __end)
1140#pragma GCC diagnostic pop
1152 {
assign(__il.begin(), __il.end()); }
1157 {
return allocator_type(this->_M_get_Node_allocator()); }
1168 {
return iterator(this->_M_impl._M_head._M_base_ptr()); }
1178 {
return const_iterator(this->_M_impl._M_head._M_base_ptr()); }
1187 {
return iterator(this->_M_impl._M_head._M_next); }
1197 {
return const_iterator(this->_M_impl._M_head._M_next); }
1207 {
return iterator(
nullptr); }
1217 {
return const_iterator(
nullptr); }
1227 {
return const_iterator(this->_M_impl._M_head._M_next); }
1237 {
return const_iterator(this->_M_impl._M_head._M_base_ptr()); }
1247 {
return const_iterator(
nullptr); }
1256 {
return this->_M_impl._M_head._M_next ==
nullptr; }
1276 __glibcxx_requires_nonempty();
1277 _Node& __front =
static_cast<_Node&
>(*this->_M_impl._M_head._M_next);
1278 return *__front._M_valptr();
1289 __glibcxx_requires_nonempty();
1290 _Node& __front =
static_cast<_Node&
>(*this->_M_impl._M_head._M_next);
1291 return *__front._M_valptr();
1307 template<
typename... _Args>
1308#if __cplusplus > 201402L
1316 std::forward<_Args>(__args)...);
1317#if __cplusplus > 201402L
1343#if __glibcxx_ranges_to_container
1359 template<__detail::__container_compatible_range<_Tp> _Rg>
1361 prepend_range(_Rg&& __rg)
1363 forward_list __tmp(from_range, std::forward<_Rg>(__rg),
1385 __glibcxx_requires_nonempty();
1386 this->_M_erase_after(this->_M_impl._M_head._M_base_ptr());
1402 template<
typename... _Args>
1405 {
return iterator(this->_M_insert_after(__pos,
1406 std::forward<_Args>(__args)...)); }
1422 {
return iterator(this->_M_insert_after(__pos, __val)); }
1447 insert_after(const_iterator __pos, size_type __n,
const _Tp& __val);
1464 template<
typename _InputIterator,
1465 typename = std::_RequireInputIter<_InputIterator>>
1468 _InputIterator __first, _InputIterator __last);
1487 {
return insert_after(__pos, __il.begin(), __il.end()); }
1489#if __glibcxx_ranges_to_container
1505 template<__detail::__container_compatible_range<_Tp> _Rg>
1507 insert_range_after(const_iterator __position, _Rg&& __rg)
1509 forward_list __tmp(from_range, std::forward<_Rg>(__rg),
1511 return _M_splice_after(__position, __tmp.before_begin(), __tmp.end());
1534 {
return iterator(this->_M_erase_after(__pos._M_const_cast()._M_node)); }
1558 return iterator(this->_M_erase_after(__pos._M_const_cast()._M_node,
1559 __last._M_const_cast()._M_node));
1577 std::swap(this->_M_impl._M_head._M_next,
1578 __list._M_impl._M_head._M_next);
1579 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1580 __list._M_get_Node_allocator());
1610 resize(size_type __sz,
const value_type& __val);
1622 { this->_M_erase_after(this->_M_impl._M_head._M_base_ptr(),
nullptr); }
1640 if (!__list.empty())
1641 _M_splice_after(__pos, __list.before_begin(), __list.end());
1660 const_iterator __i)
noexcept;
1664 const_iterator __i)
noexcept
1683 const_iterator __before, const_iterator __last)
noexcept
1684 { _M_splice_after(__pos, __before, __last); }
1688 const_iterator __before, const_iterator __last)
noexcept
1689 { _M_splice_after(__pos, __before, __last); }
1693#ifdef __glibcxx_list_remove_return_type
1694 using __remove_return_type = size_type;
1695# define _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG \
1696 __attribute__((__abi_tag__("__cxx20")))
1698 using __remove_return_type = void;
1699# define _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG
1714 _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG
1715 __remove_return_type
1716 remove(
const _Tp& __val);
1729 template<
typename _Pred>
1730 __remove_return_type
1743 _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG
1744 __remove_return_type
1748#undef _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG
1762 template<
typename _BinPred>
1763 __remove_return_type
1794 template<
typename _Comp>
1798 template<
typename _Comp>
1819 template<
typename _Comp>
1830 { this->_M_impl._M_head._M_reverse_after(); }
1834 template<
typename _InputIterator>
1836 _M_range_initialize(_InputIterator __first, _InputIterator __last);
1841 _M_fill_initialize(size_type __n,
const value_type& __value);
1845 _M_splice_after(const_iterator __pos, const_iterator __before,
1846 const_iterator __last);
1850 _M_default_initialize(size_type __n);
1854 _M_default_insert_after(const_iterator __pos, size_type __n);
1856#if ! _GLIBCXX_INLINE_VERSION
1857#pragma GCC diagnostic push
1858#pragma GCC diagnostic ignored "-Wc++17-extensions"
1874#if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
1879 this->_M_impl._M_head._M_next = __list._M_impl._M_head._M_next;
1880 __list._M_impl._M_head._M_next =
nullptr;
1881 std::__alloc_on_move(this->_M_get_Node_allocator(),
1882 __list._M_get_Node_allocator());
1889#if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
1890 if constexpr (is_same<typename _Alloc_traits::pointer, _Tp*>::value)
1893 if (__list._M_get_Node_allocator() == this->_M_get_Node_allocator())
1898 this->
assign(std::make_move_iterator(__list.begin()),
1899 std::make_move_iterator(__list.end()));
1904 _M_assign_n(size_type __n,
const _Tp& __val,
true_type)
1906#if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
1907 if constexpr (is_same<typename _Alloc_traits::pointer, _Tp*>::value)
1911 auto __curr =
begin();
1913 while (__curr != __end && __n > 0)
1922 else if (__curr != __end)
1928 _M_assign_n(size_type __n,
const _Tp& __val,
false_type)
1930#if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST
1931 if constexpr (is_same<typename _Alloc_traits::pointer, _Tp*>::value)
1938#pragma GCC diagnostic pop
1942#if __cpp_deduction_guides >= 201606
1943 template<
typename _InputIterator,
typename _ValT
1944 =
typename iterator_traits<_InputIterator>::value_type,
1945 typename _Allocator = allocator<_ValT>,
1946 typename = _RequireInputIter<_InputIterator>,
1947 typename = _RequireAllocator<_Allocator>>
1948 forward_list(_InputIterator, _InputIterator, _Allocator = _Allocator())
1949 -> forward_list<_ValT, _Allocator>;
1951#if __glibcxx_ranges_to_container
1952 template<ranges::input_range _Rg,
1953 typename _Allocator = allocator<ranges::range_value_t<_Rg>>>
1954 forward_list(from_range_t, _Rg&&, _Allocator = _Allocator())
1955 -> forward_list<ranges::range_value_t<_Rg>, _Allocator>;
1969 template<
typename _Tp,
typename _Alloc>
1975#if __cpp_lib_three_way_comparison
1987 template<
typename _Tp,
typename _Alloc>
1989 inline __detail::__synth3way_t<_Tp>
1994 __y.begin(), __y.end(),
1995 __detail::__synth3way);
2010 template<
typename _Tp,
typename _Alloc>
2013 operator<(
const forward_list<_Tp, _Alloc>& __lx,
2014 const forward_list<_Tp, _Alloc>& __ly)
2015 {
return std::lexicographical_compare(__lx.cbegin(), __lx.cend(),
2016 __ly.cbegin(), __ly.cend()); }
2019 template<
typename _Tp,
typename _Alloc>
2022 operator!=(
const forward_list<_Tp, _Alloc>& __lx,
2023 const forward_list<_Tp, _Alloc>& __ly)
2024 {
return !(__lx == __ly); }
2027 template<
typename _Tp,
typename _Alloc>
2030 operator>(
const forward_list<_Tp, _Alloc>& __lx,
2031 const forward_list<_Tp, _Alloc>& __ly)
2032 {
return (__ly < __lx); }
2035 template<
typename _Tp,
typename _Alloc>
2038 operator>=(
const forward_list<_Tp, _Alloc>& __lx,
2039 const forward_list<_Tp, _Alloc>& __ly)
2040 {
return !(__lx < __ly); }
2043 template<
typename _Tp,
typename _Alloc>
2046 operator<=(
const forward_list<_Tp, _Alloc>& __lx,
2047 const forward_list<_Tp, _Alloc>& __ly)
2048 {
return !(__ly < __lx); }
2052 template<
typename _Tp,
typename _Alloc>
2056 noexcept(
noexcept(__lx.swap(__ly)))
2057 { __lx.swap(__ly); }
2059_GLIBCXX_END_NAMESPACE_CONTAINER
2060_GLIBCXX_END_NAMESPACE_VERSION
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
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.
constexpr auto lexicographical_compare_three_way(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _Comp __comp) -> decltype(__comp(*__first1, *__first2))
Performs dictionary comparison on ranges.
ISO C++ entities toplevel namespace is std.
is_nothrow_default_constructible
is_trivially_destructible
Uniform interface to all allocator types.
__detected_or_t< value_type *, __pointer, _Alloc > pointer
The allocator's pointer type.
A helper basic node class for forward_list.
A helper node class for forward_list. This is just a linked list with uninitialized storage for a dat...
A forward_list::const_iterator.
friend bool operator==(const _Self &__x, const _Self &__y) noexcept
Forward list const_iterator equality comparison.
A forward_list::iterator.
friend bool operator==(const _Self &__x, const _Self &__y) noexcept
Forward list iterator equality comparison.
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
__remove_return_type unique(_BinPred __binary_pred)
Remove consecutive elements satisfying a predicate.
iterator begin() noexcept
const_iterator before_begin() const noexcept
void reverse() noexcept
Reverse the elements in list.
forward_list()=default
Creates a forward_list with no elements.
~forward_list() noexcept
The forward_list dtor.
iterator erase_after(const_iterator __pos)
Removes the element pointed to by the iterator following pos.
void swap(forward_list &__list) noexcept
Swaps data with another forward_list.
const_reference front() const
void merge(forward_list &&__list)
Merge sorted lists.
forward_list(const _Alloc &__al) noexcept
Creates a forward_list with no elements.
void sort()
Sort the elements of the list.
iterator before_begin() noexcept
forward_list(const forward_list &__list, const __type_identity_t< _Alloc > &__al)
Copy constructor with allocator argument.
iterator emplace_after(const_iterator __pos, _Args &&... __args)
Constructs object in forward_list after the specified iterator.
forward_list(const forward_list &__list)
The forward_list copy constructor.
iterator insert_after(const_iterator __pos, const _Tp &__val)
Inserts given value into forward_list after specified iterator.
forward_list & operator=(forward_list &&__list) noexcept(_Node_alloc_traits::_S_nothrow_move())
The forward_list move assignment operator.
void resize(size_type __sz)
Resizes the forward_list to the specified number of elements.
forward_list & operator=(const forward_list &__list)
The forward_list assignment operator.
__remove_return_type remove_if(_Pred __pred)
Remove all elements satisfying a predicate.
forward_list(size_type __n, const _Tp &__value, const _Alloc &__al=_Alloc())
Creates a forward_list with copies of an exemplar element.
void assign(size_type __n, const _Tp &__val)
Assigns a given value to a forward_list.
const_iterator begin() const noexcept
void splice_after(const_iterator __pos, forward_list &&__list) noexcept
Insert contents of another forward_list.
const_iterator cbefore_begin() const noexcept
forward_list & operator=(std::initializer_list< _Tp > __il)
The forward_list initializer list assignment operator.
forward_list(std::initializer_list< _Tp > __il, const _Alloc &__al=_Alloc())
Builds a forward_list from an initializer_list.
reference emplace_front(_Args &&... __args)
Constructs object in forward_list at the front of the list.
forward_list(size_type __n, const _Alloc &__al=_Alloc())
Creates a forward_list with default constructed elements.
iterator insert_after(const_iterator __pos, std::initializer_list< _Tp > __il)
Inserts the contents of an initializer_list into forward_list after the specified iterator.
const_iterator end() const noexcept
void splice_after(const_iterator __pos, forward_list &&, const_iterator __before, const_iterator __last) noexcept
Insert range from another forward_list.
forward_list(forward_list &&__list, const __type_identity_t< _Alloc > &__al) noexcept(_Node_alloc_traits::_S_always_equal())
Move constructor with allocator argument.
iterator erase_after(const_iterator __pos, const_iterator __last)
Remove a range of elements.
__remove_return_type unique()
Remove consecutive duplicate elements.
void clear() noexcept
Erases all the elements.
__remove_return_type remove(const _Tp &__val)
Remove all elements equal to value.
const_iterator cend() const noexcept
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a forward_list.
bool empty() const noexcept
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
void push_front(const _Tp &__val)
Add data to the front of the forward_list.
forward_list(forward_list &&)=default
The forward_list move constructor.
forward_list(_InputIterator __first, _InputIterator __last, const _Alloc &__al=_Alloc())
Builds a forward_list from a range.
void splice_after(const_iterator __pos, forward_list &, const_iterator __before, const_iterator __last) noexcept
Insert range from another forward_list.
const_iterator cbegin() const noexcept
void pop_front()
Removes first element.
void assign(std::initializer_list< _Tp > __il)
Assigns an initializer_list to a forward_list.
size_type max_size() const noexcept
Base class for forward_list.
Uniform interface to all pointer-like types.
One of the comparison functors.
One of the comparison functors.
Forward iterators support a superset of input iterator operations.
Uniform interface to C++98 and C++11 allocators.
static constexpr pointer allocate(_Alloc &__a, size_type __n)
Allocate memory.
static constexpr void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.
static constexpr size_type max_size(const _Alloc &__a) noexcept
The maximum supported allocation size.