30 #ifndef _FORWARD_LIST_H 31 #define _FORWARD_LIST_H 1 33 #ifdef _GLIBCXX_SYSHDR 34 #pragma GCC system_header 49 #if __glibcxx_containers_ranges // C++ >= 23 54 #if ! defined _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 55 # define _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 1 58 namespace 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;
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>
227 template<
typename,
typename>
232 _M_next()
const noexcept
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) { }
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>
317 template<
typename,
typename>
321 _M_next()
const noexcept
330 _M_const_cast()
const noexcept
344 #if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 346 template<
typename _Vo
idPtr>
354 : _M_next(__x._M_next)
355 { __x._M_next =
nullptr; }
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;
416 template<
typename _ValPtr>
418 :
public _Node_base<__ptr_rebind<_ValPtr, void>>
427 union _Uninit_storage
429 _Uninit_storage() noexcept { }
430 ~_Uninit_storage() { }
432 #if ! _GLIBCXX_INLINE_VERSION 434 alignas(__alignof__(value_type))
438 _Uninit_storage _M_u;
445 _M_valptr()
const noexcept
454 template<
bool _Const,
typename _Ptr>
461 template<
typename _Tp>
462 using __maybe_const = __conditional_t<_Const, const _Tp, _Tp>;
465 using value_type =
typename pointer_traits<_Ptr>::element_type;
466 using difference_type = ptrdiff_t;
468 using pointer = __maybe_const<value_type>*;
469 using reference = __maybe_const<value_type>&;
471 constexpr
_Iterator() noexcept : _M_node() { }
476 #ifdef __glibcxx_concepts 480 template<
bool _OtherConst,
481 typename = __enable_if_t<_Const && !_OtherConst>>
485 : _M_node(__i._M_node) { }
494 {
return static_cast<_Node&
>(*this->_M_node)._M_u._M_data; }
498 operator->()
const noexcept
499 {
return static_cast<_Node&
>(*this->_M_node)._M_valptr(); }
502 operator++() noexcept
504 _M_node = _M_node->_M_next;
509 operator++(
int) noexcept
512 _M_node = _M_node->_M_next;
520 friend constexpr
bool 522 {
return __x._M_node == __y._M_node; }
524 #if __cpp_impl_three_way_comparison < 201907L 529 friend constexpr
bool 531 {
return __x._M_node != __y._M_node; }
535 template<
typename _Tp,
typename _Allocator>
536 friend class _GLIBCXX_STD_C::forward_list;
537 template<
typename _Tp,
typename _Allocator>
538 friend struct _GLIBCXX_STD_C::_Fwd_list_base;
541 _M_const_cast()
const noexcept
547 _M_next()
const noexcept
548 {
return _Iterator(_M_node ? _M_node->_M_next :
nullptr); }
552 #endif // USE_ALLOC_PTR_FOR_FWD_LIST 555 template<
typename _Tp,
typename _Ptr>
558 #if _GLIBCXX_USE_ALLOC_PTR_FOR_LIST <= 9000 562 template<
typename _Tp>
563 struct _Node_traits<_Tp, _Tp*>
572 #if ! _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 574 template<
typename _Tp,
typename _Ptr>
576 : _Node_traits<_Tp, _Tp*>
580 template<
typename _Tp,
typename _Ptr>
593 #endif // USE_ALLOC_PTR_FOR_FWD_LIST 599 template<
typename _Tp,
typename _Alloc>
602 #if __cplusplus > 201703L || defined __STRICT_ANSI__ 606 using _Tp_alloc_traits
608 using pointer =
typename _Tp_alloc_traits::pointer;
612 using _Node_traits = __fwdlist::_Node_traits<_Tp, pointer>;
614 using _Node_alloc_type = __alloc_rebind<_Alloc, _Node>;
616 using _Node_ptr =
typename _Node_alloc_traits::pointer;
617 using _Base_ptr =
typename _Node_traits::_Node_base::_Base_ptr;
619 struct _Fwd_list_impl
620 :
public _Node_alloc_type
626 : _Node_alloc_type(), _M_head()
629 _Fwd_list_impl(_Fwd_list_impl&&) =
default;
631 _Fwd_list_impl(_Fwd_list_impl&& __fl, _Node_alloc_type&& __a)
635 _Fwd_list_impl(_Node_alloc_type&& __a)
636 : _Node_alloc_type(
std::move(__a)), _M_head()
640 _Fwd_list_impl _M_impl;
647 _M_get_Node_allocator() noexcept
648 {
return this->_M_impl; }
650 const _Node_alloc_type&
651 _M_get_Node_allocator()
const noexcept
652 {
return this->_M_impl; }
671 { _M_erase_after(_M_impl._M_head._M_base_ptr(),
nullptr); }
674 #if ! _GLIBCXX_INLINE_VERSION 679 auto __ptr = _Node_alloc_traits::allocate(_M_get_Node_allocator(), 1);
680 return std::__to_address(__ptr);
685 _M_put_node(_Node_ptr __p)
687 #if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 688 _Node_alloc_traits::deallocate(_M_get_Node_allocator(), __p, 1);
690 typedef typename _Node_alloc_traits::pointer _Ptr;
692 _Node_alloc_traits::deallocate(_M_get_Node_allocator(), __ptr, 1);
696 template<
typename... _Args>
698 _M_create_node(_Args&&... __args)
700 auto& __alloc = _M_get_Node_allocator();
701 auto __guard = std::__allocate_guarded_obj(__alloc);
702 _Node_alloc_traits::construct(__alloc, __guard->_M_valptr(),
703 std::forward<_Args>(__args)...);
704 auto __p = __guard.release();
705 #if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 708 return std::__to_address(__p);
712 #pragma GCC diagnostic push 713 #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr 715 _M_destroy_node(_Node_ptr __p)
717 auto& __alloc = _M_get_Node_allocator();
719 _Node_alloc_traits::destroy(__alloc, __p->_M_valptr());
725 #pragma GCC diagnostic pop 727 template<
typename... _Args>
729 _M_insert_after(const_iterator __pos, _Args&&... __args);
732 _M_erase_after(_Base_ptr __pos);
735 _M_erase_after(_Base_ptr __pos, _Base_ptr __last);
766 template<
typename _Tp,
typename _Alloc = allocator<_Tp>>
769 static_assert(
is_same<
typename remove_cv<_Tp>::type, _Tp>::value,
770 "std::forward_list must have a non-const, non-volatile value_type");
771 #if __cplusplus > 201703L || defined __STRICT_ANSI__ 773 "std::forward_list must have the same value_type as its allocator");
779 typedef typename _Base::_Node
_Node;
780 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
781 typedef typename _Base::_Node_alloc_traits _Node_alloc_traits;
786 typedef _Tp value_type;
787 typedef typename _Alloc_traits::pointer pointer;
788 typedef typename _Alloc_traits::const_pointer const_pointer;
789 typedef value_type& reference;
790 typedef const value_type& const_reference;
792 typedef typename _Base::iterator
iterator;
793 typedef typename _Base::const_iterator const_iterator;
794 typedef std::size_t size_type;
795 typedef std::ptrdiff_t difference_type;
796 typedef _Alloc allocator_type;
811 : _Base(_Node_alloc_type(__al))
820 const __type_identity_t<_Alloc>& __al)
821 : _Base(_Node_alloc_type(__al))
822 { _M_range_initialize(__list.
begin(), __list.
end()); }
831 insert_after(cbefore_begin(),
832 std::__make_move_if_noexcept_iterator(__list.begin()),
833 std::__make_move_if_noexcept_iterator(__list.end()));
849 const __type_identity_t<_Alloc>& __al)
850 noexcept(_Node_alloc_traits::_S_always_equal())
852 typename _Node_alloc_traits::is_always_equal{})
865 : _Base(_Node_alloc_type(__al))
866 { _M_default_initialize(__n); }
878 const _Alloc& __al = _Alloc())
879 : _Base(_Node_alloc_type(__al))
880 { _M_fill_initialize(__n, __value); }
892 template<
typename _InputIterator,
893 typename = std::_RequireInputIter<_InputIterator>>
895 const _Alloc& __al = _Alloc())
896 : _Base(_Node_alloc_type(__al))
897 { _M_range_initialize(__first, __last); }
899 #if __glibcxx_containers_ranges // C++ >= 23 908 template<__detail::__container_compatible_range<_Tp> _Rg>
909 forward_list(from_range_t, _Rg&& __rg,
const _Alloc& __a = _Alloc())
910 : _Base(_Node_alloc_type(__a))
912 auto __to = this->_M_impl._M_head._M_base_ptr();
913 auto __first = ranges::begin(__rg);
914 const auto __last = ranges::end(__rg);
915 for (; __first != __last; ++__first)
917 __to->_M_next = this->_M_create_node(*__first)->_M_base_ptr();
918 __to = __to->_M_next;
921 #endif // containers_ranges 929 : _Base(_Node_alloc_traits::_S_select_on_copy(
930 __list._M_get_Node_allocator()))
931 { _M_range_initialize(__list.
begin(), __list.
end()); }
953 const _Alloc& __al = _Alloc())
954 : _Base(_Node_alloc_type(__al))
955 { _M_range_initialize(__il.begin(), __il.end()); }
975 #pragma GCC diagnostic push 976 #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr 991 noexcept(_Node_alloc_traits::_S_nothrow_move())
993 constexpr
bool __move_storage =
994 _Node_alloc_traits::_S_propagate_on_move_assign()
995 || _Node_alloc_traits::_S_always_equal();
996 if constexpr (!__move_storage)
998 if (__list._M_get_Node_allocator() != this->_M_get_Node_allocator())
1002 this->assign(std::make_move_iterator(__list.
begin()),
1003 std::make_move_iterator(__list.
end()));
1009 this->_M_impl._M_head._M_next = __list._M_impl._M_head._M_next;
1010 __list._M_impl._M_head._M_next =
nullptr;
1011 if constexpr (_Node_alloc_traits::_S_propagate_on_move_assign())
1012 this->_M_get_Node_allocator()
1013 =
std::move(__list._M_get_Node_allocator());
1044 template<
typename _InputIterator,
1045 typename = std::_RequireInputIter<_InputIterator>>
1047 assign(_InputIterator __first, _InputIterator __last)
1049 if constexpr (
is_assignable<_Tp&, decltype(*__first)>::value)
1051 auto __prev = before_begin();
1052 auto __curr =
begin();
1054 while (__curr != __end && __first != __last)
1061 if (__first != __last)
1062 insert_after(__prev, __first, __last);
1063 else if (__curr != __end)
1064 erase_after(__prev, __end);
1069 insert_after(cbefore_begin(), __first, __last);
1072 #pragma GCC diagnostic pop 1074 #if __glibcxx_containers_ranges // C++ >= 23 1079 template<__detail::__container_compatible_range<_Tp> _Rg>
1081 assign_range(_Rg&& __rg)
1085 auto __first = ranges::begin(__rg);
1086 const auto __last = ranges::end(__rg);
1087 iterator __prev = before_begin();
1088 iterator __curr =
begin();
1089 const iterator __end =
end();
1091 while (__curr != __end && __first != __last)
1099 if (__curr != __end)
1100 erase_after(__prev, __end);
1102 insert_range_after(__prev,
1103 ranges::subrange(
std::move(__first), __last));
1105 #endif // containers_ranges 1107 #pragma GCC diagnostic push 1108 #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr 1124 auto __prev = before_begin();
1125 auto __curr =
begin();
1127 while (__curr != __end && __n > 0)
1135 insert_after(__prev, __n, __val);
1136 else if (__curr != __end)
1137 erase_after(__prev, __end);
1142 insert_after(cbefore_begin(), __n, __val);
1145 #pragma GCC diagnostic pop 1157 { assign(__il.begin(), __il.end()); }
1162 {
return allocator_type(this->_M_get_Node_allocator()); }
1173 {
return iterator(this->_M_impl._M_head._M_base_ptr()); }
1183 {
return const_iterator(this->_M_impl._M_head._M_base_ptr()); }
1192 {
return iterator(this->_M_impl._M_head._M_next); }
1202 {
return const_iterator(this->_M_impl._M_head._M_next); }
1212 {
return iterator(
nullptr); }
1222 {
return const_iterator(
nullptr); }
1232 {
return const_iterator(this->_M_impl._M_head._M_next); }
1242 {
return const_iterator(this->_M_impl._M_head._M_base_ptr()); }
1252 {
return const_iterator(
nullptr); }
1261 {
return this->_M_impl._M_head._M_next ==
nullptr; }
1269 {
return _Node_alloc_traits::max_size(this->_M_get_Node_allocator()); }
1281 __glibcxx_requires_nonempty();
1282 _Node& __front =
static_cast<_Node&
>(*this->_M_impl._M_head._M_next);
1283 return *__front._M_valptr();
1294 __glibcxx_requires_nonempty();
1295 _Node& __front =
static_cast<_Node&
>(*this->_M_impl._M_head._M_next);
1296 return *__front._M_valptr();
1312 template<
typename... _Args>
1313 #if __cplusplus > 201402L 1320 this->_M_insert_after(cbefore_begin(),
1321 std::forward<_Args>(__args)...);
1322 #if __cplusplus > 201402L 1339 { this->_M_insert_after(cbefore_begin(), __val); }
1345 push_front(_Tp&& __val)
1346 { this->_M_insert_after(cbefore_begin(),
std::move(__val)); }
1348 #if __glibcxx_containers_ranges // C++ >= 23 1364 template<__detail::__container_compatible_range<_Tp> _Rg>
1366 prepend_range(_Rg&& __rg)
1368 forward_list __tmp(from_range, std::forward<_Rg>(__rg),
1371 splice_after(before_begin(), __tmp);
1373 #endif // containers_ranges 1390 __glibcxx_requires_nonempty();
1391 this->_M_erase_after(this->_M_impl._M_head._M_base_ptr());
1407 template<
typename... _Args>
1410 {
return iterator(this->_M_insert_after(__pos,
1411 std::forward<_Args>(__args)...)); }
1427 {
return iterator(this->_M_insert_after(__pos, __val)); }
1433 insert_after(const_iterator __pos, _Tp&& __val)
1434 {
return iterator(this->_M_insert_after(__pos,
std::move(__val))); }
1452 insert_after(const_iterator __pos, size_type __n,
const _Tp& __val);
1469 template<
typename _InputIterator,
1470 typename = std::_RequireInputIter<_InputIterator>>
1472 insert_after(const_iterator __pos,
1473 _InputIterator __first, _InputIterator __last);
1492 {
return insert_after(__pos, __il.begin(), __il.end()); }
1494 #if __glibcxx_containers_ranges // C++ >= 23 1510 template<__detail::__container_compatible_range<_Tp> _Rg>
1512 insert_range_after(const_iterator __position, _Rg&& __rg)
1514 forward_list __tmp(from_range, std::forward<_Rg>(__rg),
1516 return _M_splice_after(__position, __tmp.
before_begin(), __tmp.
end());
1518 #endif // containers_ranges 1539 {
return iterator(this->_M_erase_after(__pos._M_const_cast()._M_node)); }
1563 return iterator(this->_M_erase_after(__pos._M_const_cast()._M_node,
1564 __last._M_const_cast()._M_node));
1582 std::swap(this->_M_impl._M_head._M_next,
1583 __list._M_impl._M_head._M_next);
1584 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1585 __list._M_get_Node_allocator());
1600 resize(size_type __sz);
1615 resize(size_type __sz,
const value_type& __val);
1627 { this->_M_erase_after(this->_M_impl._M_head._M_base_ptr(),
nullptr); }
1645 if (!__list.
empty())
1650 splice_after(const_iterator __pos,
forward_list& __list) noexcept
1651 { splice_after(__pos,
std::move(__list)); }
1664 splice_after(const_iterator __pos,
forward_list&& __list,
1665 const_iterator __i) noexcept;
1668 splice_after(const_iterator __pos,
forward_list& __list,
1669 const_iterator __i) noexcept
1670 { splice_after(__pos,
std::move(__list), __i); }
1688 const_iterator __before, const_iterator __last) noexcept
1689 { _M_splice_after(__pos, __before, __last); }
1693 const_iterator __before, const_iterator __last) noexcept
1694 { _M_splice_after(__pos, __before, __last); }
1698 #ifdef __glibcxx_list_remove_return_type // C++20 && HOSTED 1699 using __remove_return_type = size_type;
1700 # define _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG \ 1701 __attribute__((__abi_tag__("__cxx20"))) 1703 using __remove_return_type = void;
1704 # define _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG 1719 _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG
1720 __remove_return_type
1721 remove(
const _Tp& __val);
1734 template<
typename _Pred>
1735 __remove_return_type
1736 remove_if(_Pred __pred);
1748 _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG
1749 __remove_return_type
1753 #undef _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG 1767 template<
typename _BinPred>
1768 __remove_return_type
1769 unique(_BinPred __binary_pred);
1799 template<
typename _Comp>
1803 template<
typename _Comp>
1824 template<
typename _Comp>
1835 { this->_M_impl._M_head._M_reverse_after(); }
1839 template<
typename _InputIterator>
1841 _M_range_initialize(_InputIterator __first, _InputIterator __last);
1846 _M_fill_initialize(size_type __n,
const value_type& __value);
1850 _M_splice_after(const_iterator __pos, const_iterator __before,
1851 const_iterator __last);
1855 _M_default_initialize(size_type __n);
1859 _M_default_insert_after(const_iterator __pos, size_type __n);
1861 #if ! _GLIBCXX_INLINE_VERSION 1862 #pragma GCC diagnostic push 1863 #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr 1879 #if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 1884 this->_M_impl._M_head._M_next = __list._M_impl._M_head._M_next;
1885 __list._M_impl._M_head._M_next =
nullptr;
1886 std::__alloc_on_move(this->_M_get_Node_allocator(),
1887 __list._M_get_Node_allocator());
1894 #if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 1898 if (__list._M_get_Node_allocator() == this->_M_get_Node_allocator())
1903 this->assign(std::make_move_iterator(__list.
begin()),
1904 std::make_move_iterator(__list.
end()));
1909 _M_assign_n(size_type __n,
const _Tp& __val,
true_type)
1911 #if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 1915 auto __prev = before_begin();
1916 auto __curr =
begin();
1918 while (__curr != __end && __n > 0)
1926 insert_after(__prev, __n, __val);
1927 else if (__curr != __end)
1928 erase_after(__prev, __end);
1933 _M_assign_n(size_type __n,
const _Tp& __val,
false_type)
1935 #if _GLIBCXX_USE_ALLOC_PTR_FOR_FWD_LIST 1940 insert_after(cbefore_begin(), __n, __val);
1943 #pragma GCC diagnostic pop 1944 #endif // ! _GLIBCXX_INLINE_VERSION 1947 #if __cpp_deduction_guides >= 201606 1948 template<
typename _InputIterator,
typename _ValT
1951 typename = _RequireInputIter<_InputIterator>,
1952 typename = _RequireAllocator<_Allocator>>
1953 forward_list(_InputIterator, _InputIterator, _Allocator = _Allocator())
1956 #if __glibcxx_containers_ranges // C++ >= 23 1957 template<ranges::input_range _Rg,
1959 forward_list(from_range_t, _Rg&&, _Allocator = _Allocator())
1974 template<
typename _Tp,
typename _Alloc>
1980 #if __cpp_lib_three_way_comparison 1992 template<
typename _Tp,
typename _Alloc>
1994 inline __detail::__synth3way_t<_Tp>
2000 __detail::__synth3way);
2015 template<
typename _Tp,
typename _Alloc>
2018 operator<(const forward_list<_Tp, _Alloc>& __lx,
2024 template<
typename _Tp,
typename _Alloc>
2029 {
return !(__lx == __ly); }
2032 template<
typename _Tp,
typename _Alloc>
2037 {
return (__ly < __lx); }
2040 template<
typename _Tp,
typename _Alloc>
2045 {
return !(__lx < __ly); }
2048 template<
typename _Tp,
typename _Alloc>
2051 operator<=(const forward_list<_Tp, _Alloc>& __lx,
2053 {
return !(__ly < __lx); }
2054 #endif // three-way comparison 2057 template<
typename _Tp,
typename _Alloc>
2061 noexcept(noexcept(__lx.swap(__ly)))
2062 { __lx.swap(__ly); }
2064 _GLIBCXX_END_NAMESPACE_CONTAINER
2065 _GLIBCXX_END_NAMESPACE_VERSION
2068 #endif // _FORWARD_LIST_H forward_list(const forward_list &__list)
The forward_list copy constructor.
iterator before_begin() noexcept
forward_list(forward_list &&__list, const __type_identity_t< _Alloc > &__al) noexcept(_Node_alloc_traits::_S_always_equal())
Move constructor with allocator argument.
void clear() noexcept
Erases all the elements.
typename pointer_traits< _Ptr >::template rebind< _Tp > __ptr_rebind
Convenience alias for rebinding pointers.
Uniform interface to all allocator types.
void swap(forward_list &__list) noexcept
Swaps data with another forward_list.
friend bool operator==(const _Self &__x, const _Self &__y) noexcept
Forward list iterator equality comparison.
const_iterator end() const noexcept
iterator erase_after(const_iterator __pos, const_iterator __last)
Remove a range of elements.
~forward_list() noexcept
The forward_list dtor.
const_iterator before_begin() const noexcept
const_reference front() const
void reverse() noexcept
Reverse the elements in list.
Uniform interface to C++98 and C++11 allocators.
void splice_after(const_iterator __pos, forward_list &&__list) noexcept
Insert contents of another forward_list.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
void splice_after(const_iterator __pos, forward_list &&, const_iterator __before, const_iterator __last) noexcept
Insert range from another forward_list.
iterator insert_after(const_iterator __pos, const _Tp &__val)
Inserts given value into forward_list after specified iterator.
forward_list(size_type __n, const _Alloc &__al=_Alloc())
Creates a forward_list with default constructed elements.
One of the comparison functors.
forward_list(const forward_list &__list, const __type_identity_t< _Alloc > &__al)
Copy constructor with allocator argument.
__detected_or_t< value_type *, __pointer, _Alloc > pointer
The allocator's pointer type.
void splice_after(const_iterator __pos, forward_list &, const_iterator __before, const_iterator __last) noexcept
Insert range from another forward_list.
const_iterator cbefore_begin() const noexcept
Uniform interface to all pointer-like types.
ISO C++ entities toplevel namespace is std.
forward_list(const _Alloc &__al) noexcept
Creates a forward_list with no elements.
void pop_front()
Removes first element.
size_type max_size() const noexcept
A helper basic node class for forward_list.
forward_list(_InputIterator __first, _InputIterator __last, const _Alloc &__al=_Alloc())
Builds a forward_list from a range.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
Forward iterators support a superset of input iterator operations.
_Tp * end(valarray< _Tp > &__va) noexcept
Return an iterator pointing to one past the last element of the valarray.
void sort()
Sort the elements of the list.
reference emplace_front(_Args &&... __args)
Constructs object in forward_list at the front of the list.
forward_list(size_type __n, const _Tp &__value, const _Alloc &__al=_Alloc())
Creates a forward_list with copies of an exemplar element.
Base class for forward_list.
concept assignable_from
[concept.assignable], concept assignable_from
bool empty() const noexcept
constexpr bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
__remove_return_type unique()
Remove consecutive duplicate elements.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
iterator begin() noexcept
void merge(forward_list &&__list)
Merge sorted lists.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
forward_list & operator=(std::initializer_list< _Tp > __il)
The forward_list initializer list assignment operator.
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a forward_list.
iterator emplace_after(const_iterator __pos, _Args &&... __args)
Constructs object in forward_list after the specified iterator.
A forward_list::const_iterator.
void assign(std::initializer_list< _Tp > __il)
Assigns an initializer_list to a forward_list.
is_trivially_destructible
The standard allocator, as per C++03 [20.4.1].
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
forward_list & operator=(forward_list &&__list) noexcept(_Node_alloc_traits::_S_nothrow_move())
The forward_list move assignment operator.
friend bool operator==(const _Self &__x, const _Self &__y) noexcept
Forward list const_iterator equality comparison.
iterator erase_after(const_iterator __pos)
Removes the element pointed to by the iterator following pos.
const_iterator cend() const noexcept
void assign(size_type __n, const _Tp &__val)
Assigns a given value to a forward_list.
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
forward_list(std::initializer_list< _Tp > __il, const _Alloc &__al=_Alloc())
Builds a forward_list from an initializer_list.
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...
A helper node class for forward_list.
One of the comparison functors.
is_nothrow_default_constructible
friend constexpr bool operator==(const _Iterator &__x, const _Iterator &__y) noexcept
Forward list iterator equality comparison.
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
const_iterator cbegin() const noexcept
A helper node class for forward_list. This is just a linked list with uninitialized storage for a dat...
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.
Traits class for iterators.
A forward_list iterator when the allocator uses fancy pointers.
void push_front(const _Tp &__val)
Add data to the front of the forward_list.
const_iterator begin() const noexcept
The node-base type for allocators that use fancy pointers.
_Tp * begin(valarray< _Tp > &__va) noexcept
Return an iterator pointing to the first element of the valarray.
A forward_list::iterator.