60 #if __cplusplus >= 201103L
64 namespace std _GLIBCXX_VISIBILITY(default)
68 _GLIBCXX_BEGIN_NAMESPACE_VERSION
90 _M_reverse() _GLIBCXX_USE_NOEXCEPT;
96 _M_unhook() _GLIBCXX_USE_NOEXCEPT;
99 _GLIBCXX_END_NAMESPACE_VERSION
102 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
105 template<
typename _Tp>
111 #if __cplusplus >= 201103L
112 template<
typename... _Args>
114 : __detail::_List_node_base(),
_M_data(std::
forward<_Args>(__args)...)
124 template<
typename _Tp>
130 typedef ptrdiff_t difference_type;
132 typedef _Tp value_type;
133 typedef _Tp* pointer;
134 typedef _Tp& reference;
144 _M_const_cast()
const _GLIBCXX_NOEXCEPT
149 operator*()
const _GLIBCXX_NOEXCEPT
150 {
return static_cast<_Node*
>(_M_node)->_M_data; }
153 operator->()
const _GLIBCXX_NOEXCEPT
157 operator++() _GLIBCXX_NOEXCEPT
159 _M_node = _M_node->_M_next;
164 operator++(
int) _GLIBCXX_NOEXCEPT
167 _M_node = _M_node->_M_next;
172 operator--() _GLIBCXX_NOEXCEPT
174 _M_node = _M_node->_M_prev;
179 operator--(
int) _GLIBCXX_NOEXCEPT
182 _M_node = _M_node->_M_prev;
187 operator==(
const _Self& __x)
const _GLIBCXX_NOEXCEPT
188 {
return _M_node == __x._M_node; }
191 operator!=(
const _Self& __x)
const _GLIBCXX_NOEXCEPT
192 {
return _M_node != __x._M_node; }
203 template<
typename _Tp>
210 typedef ptrdiff_t difference_type;
212 typedef _Tp value_type;
213 typedef const _Tp* pointer;
214 typedef const _Tp& reference;
225 : _M_node(__x._M_node) { }
228 _M_const_cast()
const _GLIBCXX_NOEXCEPT
229 {
return iterator(const_cast<__detail::_List_node_base*>(_M_node)); }
234 operator*()
const _GLIBCXX_NOEXCEPT
235 {
return static_cast<_Node*
>(_M_node)->_M_data; }
238 operator->()
const _GLIBCXX_NOEXCEPT
242 operator++() _GLIBCXX_NOEXCEPT
244 _M_node = _M_node->_M_next;
249 operator++(
int) _GLIBCXX_NOEXCEPT
252 _M_node = _M_node->_M_next;
257 operator--() _GLIBCXX_NOEXCEPT
259 _M_node = _M_node->_M_prev;
264 operator--(
int) _GLIBCXX_NOEXCEPT
267 _M_node = _M_node->_M_prev;
272 operator==(
const _Self& __x)
const _GLIBCXX_NOEXCEPT
273 {
return _M_node == __x._M_node; }
276 operator!=(
const _Self& __x)
const _GLIBCXX_NOEXCEPT
277 {
return _M_node != __x._M_node; }
283 template<
typename _Val>
287 {
return __x._M_node == __y._M_node; }
289 template<
typename _Val>
291 operator!=(
const _List_iterator<_Val>& __x,
292 const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
293 {
return __x._M_node != __y._M_node; }
297 template<
typename _Tp,
typename _Alloc>
314 typedef typename _Alloc::template rebind<_List_node<_Tp> >::other
317 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
320 :
public _Node_alloc_type
325 : _Node_alloc_type(), _M_node()
328 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
329 : _Node_alloc_type(__a), _M_node()
332 #if __cplusplus >= 201103L
333 _List_impl(_Node_alloc_type&& __a) _GLIBCXX_NOEXCEPT
334 : _Node_alloc_type(std::move(__a)), _M_node()
343 {
return _M_impl._Node_alloc_type::allocate(1); }
347 { _M_impl._Node_alloc_type::deallocate(__p, 1); }
350 typedef _Alloc allocator_type;
353 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
354 {
return *
static_cast<_Node_alloc_type*
>(&_M_impl); }
356 const _Node_alloc_type&
357 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
358 {
return *
static_cast<const _Node_alloc_type*
>(&_M_impl); }
361 _M_get_Tp_allocator()
const _GLIBCXX_NOEXCEPT
362 {
return _Tp_alloc_type(_M_get_Node_allocator()); }
365 get_allocator()
const _GLIBCXX_NOEXCEPT
366 {
return allocator_type(_M_get_Node_allocator()); }
372 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
376 #if __cplusplus >= 201103L
378 : _M_impl(std::move(__x._M_get_Node_allocator()))
381 __detail::_List_node_base::swap(_M_impl._M_node, __x._M_impl._M_node);
390 _M_clear() _GLIBCXX_NOEXCEPT;
393 _M_init() _GLIBCXX_NOEXCEPT
395 this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
396 this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
446 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
450 typedef typename _Alloc::value_type _Alloc_value_type;
451 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
452 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
455 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
456 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
459 typedef _Tp value_type;
460 typedef typename _Tp_alloc_type::pointer pointer;
461 typedef typename _Tp_alloc_type::const_pointer const_pointer;
462 typedef typename _Tp_alloc_type::reference reference;
463 typedef typename _Tp_alloc_type::const_reference const_reference;
468 typedef size_t size_type;
469 typedef ptrdiff_t difference_type;
470 typedef _Alloc allocator_type;
477 using _Base::_M_impl;
478 using _Base::_M_put_node;
479 using _Base::_M_get_node;
480 using _Base::_M_get_Tp_allocator;
481 using _Base::_M_get_Node_allocator;
489 #if __cplusplus < 201103L
493 _Node* __p = this->_M_get_node();
496 _M_get_Tp_allocator().construct
502 __throw_exception_again;
507 template<
typename... _Args>
511 _Node* __p = this->_M_get_node();
514 _M_get_Node_allocator().construct(__p,
515 std::forward<_Args>(__args)...);
520 __throw_exception_again;
534 list(
const allocator_type& __a = allocator_type()) _GLIBCXX_NOEXCEPT
535 :
_Base(_Node_alloc_type(__a)) { }
537 #if __cplusplus >= 201103L
548 { _M_default_initialize(__n); }
558 list(size_type __n,
const value_type& __value,
559 const allocator_type& __a = allocator_type())
560 :
_Base(_Node_alloc_type(__a))
561 { _M_fill_initialize(__n, __value); }
572 list(size_type __n,
const value_type& __value = value_type(),
573 const allocator_type& __a = allocator_type())
574 : _Base(_Node_alloc_type(__a))
575 { _M_fill_initialize(__n, __value); }
586 :
_Base(__x._M_get_Node_allocator())
587 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
589 #if __cplusplus >= 201103L
598 :
_Base(std::move(__x)) { }
609 const allocator_type& __a = allocator_type())
610 :
_Base(_Node_alloc_type(__a))
611 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
624 #if __cplusplus >= 201103L
625 template<
typename _InputIterator,
626 typename = std::_RequireInputIter<_InputIterator>>
627 list(_InputIterator __first, _InputIterator __last,
628 const allocator_type& __a = allocator_type())
629 :
_Base(_Node_alloc_type(__a))
630 { _M_initialize_dispatch(__first, __last, __false_type()); }
632 template<
typename _InputIterator>
633 list(_InputIterator __first, _InputIterator __last,
634 const allocator_type& __a = allocator_type())
635 : _Base(_Node_alloc_type(__a))
638 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
639 _M_initialize_dispatch(__first, __last, _Integral());
661 #if __cplusplus >= 201103L
689 this->
assign(__l.begin(), __l.end());
705 assign(size_type __n,
const value_type& __val)
706 { _M_fill_assign(__n, __val); }
720 #if __cplusplus >= 201103L
721 template<
typename _InputIterator,
722 typename = std::_RequireInputIter<_InputIterator>>
724 assign(_InputIterator __first, _InputIterator __last)
725 { _M_assign_dispatch(__first, __last, __false_type()); }
727 template<
typename _InputIterator>
729 assign(_InputIterator __first, _InputIterator __last)
732 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
733 _M_assign_dispatch(__first, __last, _Integral());
737 #if __cplusplus >= 201103L
747 { this->
assign(__l.begin(), __l.end()); }
753 {
return _Base::get_allocator(); }
762 {
return iterator(this->_M_impl._M_node._M_next); }
780 {
return iterator(&this->_M_impl._M_node); }
788 end() const _GLIBCXX_NOEXCEPT
805 const_reverse_iterator
823 const_reverse_iterator
827 #if __cplusplus >= 201103L
851 const_reverse_iterator
860 const_reverse_iterator
872 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
882 {
return _M_get_Node_allocator().max_size(); }
884 #if __cplusplus >= 201103L
895 resize(size_type __new_size);
908 resize(size_type __new_size,
const value_type& __x);
921 resize(size_type __new_size, value_type __x = value_type());
978 { this->_M_insert(
begin(), __x); }
980 #if __cplusplus >= 201103L
983 { this->_M_insert(
begin(), std::move(__x)); }
985 template<
typename... _Args>
987 emplace_front(_Args&&... __args)
988 { this->_M_insert(
begin(), std::forward<_Args>(__args)...); }
1005 { this->_M_erase(
begin()); }
1019 { this->_M_insert(
end(), __x); }
1021 #if __cplusplus >= 201103L
1024 { this->_M_insert(
end(), std::move(__x)); }
1026 template<
typename... _Args>
1028 emplace_back(_Args&&... __args)
1029 { this->_M_insert(
end(), std::forward<_Args>(__args)...); }
1045 { this->_M_erase(
iterator(this->_M_impl._M_node._M_prev)); }
1047 #if __cplusplus >= 201103L
1060 template<
typename... _Args>
1062 emplace(const_iterator __position, _Args&&... __args);
1076 insert(const_iterator __position,
const value_type& __x);
1093 #if __cplusplus >= 201103L
1107 {
return emplace(__position, std::move(__x)); }
1126 {
return this->
insert(__p, __l.begin(), __l.end()); }
1129 #if __cplusplus >= 201103L
1145 insert(const_iterator __position, size_type __n,
const value_type& __x);
1160 insert(
iterator __position, size_type __n,
const value_type& __x)
1163 splice(__position, __tmp);
1167 #if __cplusplus >= 201103L
1183 template<
typename _InputIterator,
1184 typename = std::_RequireInputIter<_InputIterator>>
1186 insert(const_iterator __position, _InputIterator __first,
1187 _InputIterator __last);
1202 template<
typename _InputIterator>
1204 insert(iterator __position, _InputIterator __first,
1205 _InputIterator __last)
1208 splice(__position, __tmp);
1228 #if __cplusplus >= 201103L
1229 erase(const_iterator __position) noexcept;
1231 erase(iterator __position);
1253 #if __cplusplus >= 201103L
1259 while (__first != __last)
1260 __first =
erase(__first);
1261 return __last._M_const_cast();
1276 __detail::_List_node_base::swap(this->_M_impl._M_node,
1277 __x._M_impl._M_node);
1281 std::__alloc_swap<typename _Base::_Node_alloc_type>::
1282 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator());
1311 #if __cplusplus >= 201103L
1319 _M_check_equal_allocators(__x);
1321 this->_M_transfer(__position._M_const_cast(),
1326 #if __cplusplus >= 201103L
1328 splice(const_iterator __position,
list& __x) noexcept
1329 {
splice(__position, std::move(__x)); }
1332 #if __cplusplus >= 201103L
1359 iterator __j = __i._M_const_cast();
1361 if (__position == __i || __position == __j)
1365 _M_check_equal_allocators(__x);
1367 this->_M_transfer(__position._M_const_cast(),
1368 __i._M_const_cast(), __j);
1371 #if __cplusplus >= 201103L
1384 {
splice(__position, std::move(__x), __i); }
1387 #if __cplusplus >= 201103L
1422 if (__first != __last)
1425 _M_check_equal_allocators(__x);
1427 this->_M_transfer(__position._M_const_cast(),
1428 __first._M_const_cast(),
1429 __last._M_const_cast());
1433 #if __cplusplus >= 201103L
1450 {
splice(__position, std::move(__x), __first, __last); }
1465 remove(
const _Tp& __value);
1478 template<
typename _Predicate>
1507 template<
typename _BinaryPredicate>
1509 unique(_BinaryPredicate);
1520 #if __cplusplus >= 201103L
1526 {
merge(std::move(__x)); }
1545 #if __cplusplus >= 201103L
1546 template<
typename _StrictWeakOrdering>
1548 merge(
list&& __x, _StrictWeakOrdering __comp);
1550 template<
typename _StrictWeakOrdering>
1552 merge(
list& __x, _StrictWeakOrdering __comp)
1553 {
merge(std::move(__x), __comp); }
1555 template<
typename _StrictWeakOrdering>
1557 merge(
list& __x, _StrictWeakOrdering __comp);
1567 { this->_M_impl._M_node._M_reverse(); }
1584 template<
typename _StrictWeakOrdering>
1586 sort(_StrictWeakOrdering);
1595 template<
typename _Integer>
1597 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1598 { _M_fill_initialize(static_cast<size_type>(__n), __x); }
1601 template<
typename _InputIterator>
1603 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1606 for (; __first != __last; ++__first)
1607 #
if __cplusplus >= 201103L
1608 emplace_back(*__first);
1617 _M_fill_initialize(size_type __n,
const value_type& __x)
1623 #if __cplusplus >= 201103L
1626 _M_default_initialize(size_type __n)
1634 _M_default_append(size_type __n);
1643 template<
typename _Integer>
1645 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1646 { _M_fill_assign(__n, __val); }
1649 template<
typename _InputIterator>
1651 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1657 _M_fill_assign(size_type __n,
const value_type& __val);
1662 _M_transfer(iterator __position, iterator __first, iterator __last)
1663 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
1666 #if __cplusplus < 201103L
1668 _M_insert(iterator __position,
const value_type& __x)
1671 __tmp->_M_hook(__position._M_node);
1674 template<
typename... _Args>
1676 _M_insert(iterator __position, _Args&&... __args)
1679 __tmp->_M_hook(__position._M_node);
1685 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
1687 __position._M_node->_M_unhook();
1688 _Node* __n =
static_cast<_Node*
>(__position._M_node);
1689 #if __cplusplus >= 201103L
1690 _M_get_Node_allocator().destroy(__n);
1699 _M_check_equal_allocators(
list& __x) _GLIBCXX_NOEXCEPT
1701 if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
1702 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
1717 template<
typename _Tp,
typename _Alloc>
1722 const_iterator __end1 = __x.
end();
1723 const_iterator __end2 = __y.
end();
1725 const_iterator __i1 = __x.
begin();
1726 const_iterator __i2 = __y.
begin();
1727 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
1732 return __i1 == __end1 && __i2 == __end2;
1746 template<
typename _Tp,
typename _Alloc>
1750 __y.begin(), __y.end()); }
1753 template<
typename _Tp,
typename _Alloc>
1756 {
return !(__x == __y); }
1759 template<
typename _Tp,
typename _Alloc>
1762 {
return __y < __x; }
1765 template<
typename _Tp,
typename _Alloc>
1768 {
return !(__y < __x); }
1771 template<
typename _Tp,
typename _Alloc>
1774 {
return !(__x < __y); }
1777 template<
typename _Tp,
typename _Alloc>
1782 _GLIBCXX_END_NAMESPACE_CONTAINER
void sort()
Sort the elements.
const_reverse_iterator crend() const noexcept
void remove_if(_Predicate)
Remove all elements satisfying a predicate.
reverse_iterator rbegin() noexcept
list(const allocator_type &__a=allocator_type()) noexcept
Creates a list with no elements.
list(const list &__x)
List copy constructor.
void assign(size_type __n, const value_type &__val)
Assigns a given value to a list.
iterator erase(const_iterator __position) noexcept
Remove element at given position.
list & operator=(list &&__x)
List move assignment operator.
size_type max_size() const noexcept
list(size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())
Creates a list with copies of an exemplar element.
void splice(const_iterator __position, list &&__x, const_iterator __i) noexcept
Insert element from another list.
void splice(const_iterator __position, list &&__x) noexcept
Insert contents of another list.
_Tp _M_data
< User's data.
void pop_front() noexcept
Removes first element.
const_reverse_iterator crbegin() const noexcept
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
const_reverse_iterator rend() const noexcept
const_iterator end() const noexcept
void assign(initializer_list< value_type > __l)
Assigns an initializer_list to a list.
list & operator=(initializer_list< value_type > __l)
List initializer list assignment operator.
const_reference front() const noexcept
list(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a list from an initializer_list.
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
An actual node in the list.
void resize(size_type __new_size)
Resizes the list to the specified number of elements.
iterator erase(const_iterator __first, const_iterator __last) noexcept
Remove a range of elements.
void push_front(const value_type &__x)
Add data to the front of the list.
Common part of a node in the list.
void push_back(const value_type &__x)
Add data to the end of the list.
void merge(list &&__x)
Merge sorted lists.
iterator insert(const_iterator __p, initializer_list< value_type > __l)
Inserts the contents of an initializer_list into list before specified const_iterator.
reverse_iterator rend() noexcept
See bits/stl_deque.h's _Deque_base for an explanation.
const_iterator begin() const noexcept
void splice(const_iterator __position, list &__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
void pop_back() noexcept
Removes last element.
list(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a list from a range.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a list.
Bidirectional iterators support a superset of forward iterator operations.
list & operator=(const list &__x)
List assignment operator.
iterator emplace(const_iterator __position, _Args &&...__args)
Constructs object in list before specified iterator.
const_iterator cend() const noexcept
const_reference back() const noexcept
iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into list before specified iterator.
size_type size() const noexcept
bool empty() const noexcept
void reverse() noexcept
Reverse the elements in list.
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.
iterator begin() noexcept
const_iterator cbegin() const noexcept
_Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
void unique()
Remove consecutive duplicate elements.
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
const_reverse_iterator rbegin() const noexcept
void swap(list &__x)
Swaps data with another list.
list(list &&__x) noexcept
List move constructor.
list(size_type __n)
Creates a list with default constructed elements.
_Node * _M_create_node(_Args &&...__args)
void splice(const_iterator __position, list &__x, const_iterator __i) noexcept
Insert element from another list.
reference back() noexcept
reference front() noexcept
void splice(const_iterator __position, list &&__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
iterator insert(const_iterator __position, const value_type &__x)
Inserts given value into list before specified iterator.