63 namespace std _GLIBCXX_VISIBILITY(default)
67 _GLIBCXX_BEGIN_NAMESPACE_VERSION
89 _M_reverse()
throw ();
98 _GLIBCXX_END_NAMESPACE_VERSION
101 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
104 template<
typename _Tp>
110 #ifdef __GXX_EXPERIMENTAL_CXX0X__
111 template<
typename... _Args>
113 : __detail::_List_node_base(),
_M_data(std::
forward<_Args>(__args)...)
123 template<
typename _Tp>
129 typedef ptrdiff_t difference_type;
131 typedef _Tp value_type;
132 typedef _Tp* pointer;
133 typedef _Tp& reference;
145 {
return static_cast<_Node*
>(_M_node)->_M_data; }
149 {
return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
154 _M_node = _M_node->_M_next;
162 _M_node = _M_node->_M_next;
169 _M_node = _M_node->_M_prev;
177 _M_node = _M_node->_M_prev;
182 operator==(
const _Self& __x)
const
183 {
return _M_node == __x._M_node; }
186 operator!=(
const _Self& __x)
const
187 {
return _M_node != __x._M_node; }
198 template<
typename _Tp>
205 typedef ptrdiff_t difference_type;
207 typedef _Tp value_type;
208 typedef const _Tp* pointer;
209 typedef const _Tp& reference;
219 : _M_node(__x._M_node) { }
225 {
return static_cast<_Node*
>(_M_node)->_M_data; }
229 {
return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
234 _M_node = _M_node->_M_next;
242 _M_node = _M_node->_M_next;
249 _M_node = _M_node->_M_prev;
257 _M_node = _M_node->_M_prev;
262 operator==(
const _Self& __x)
const
263 {
return _M_node == __x._M_node; }
266 operator!=(
const _Self& __x)
const
267 {
return _M_node != __x._M_node; }
273 template<
typename _Val>
277 {
return __x._M_node == __y._M_node; }
279 template<
typename _Val>
281 operator!=(
const _List_iterator<_Val>& __x,
282 const _List_const_iterator<_Val>& __y)
283 {
return __x._M_node != __y._M_node; }
287 template<
typename _Tp,
typename _Alloc>
304 typedef typename _Alloc::template rebind<_List_node<_Tp> >::other
307 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
310 :
public _Node_alloc_type
315 : _Node_alloc_type(), _M_node()
318 _List_impl(
const _Node_alloc_type& __a)
319 : _Node_alloc_type(__a), _M_node()
327 {
return _M_impl._Node_alloc_type::allocate(1); }
331 { _M_impl._Node_alloc_type::deallocate(__p, 1); }
334 typedef _Alloc allocator_type;
337 _M_get_Node_allocator()
338 {
return *
static_cast<_Node_alloc_type*
>(&this->_M_impl); }
340 const _Node_alloc_type&
341 _M_get_Node_allocator()
const
342 {
return *
static_cast<const _Node_alloc_type*
>(&this->_M_impl); }
345 _M_get_Tp_allocator()
const
346 {
return _Tp_alloc_type(_M_get_Node_allocator()); }
349 get_allocator()
const
350 {
return allocator_type(_M_get_Node_allocator()); }
360 #ifdef __GXX_EXPERIMENTAL_CXX0X__
362 : _M_impl(__x._M_get_Node_allocator())
365 __detail::_List_node_base::swap(this->_M_impl._M_node,
366 __x._M_impl._M_node);
380 this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
381 this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
428 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
432 typedef typename _Alloc::value_type _Alloc_value_type;
433 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
434 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
437 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
440 typedef _Tp value_type;
441 typedef typename _Tp_alloc_type::pointer pointer;
442 typedef typename _Tp_alloc_type::const_pointer const_pointer;
443 typedef typename _Tp_alloc_type::reference reference;
444 typedef typename _Tp_alloc_type::const_reference const_reference;
449 typedef size_t size_type;
450 typedef ptrdiff_t difference_type;
451 typedef _Alloc allocator_type;
458 using _Base::_M_impl;
459 using _Base::_M_put_node;
460 using _Base::_M_get_node;
461 using _Base::_M_get_Tp_allocator;
462 using _Base::_M_get_Node_allocator;
469 #ifndef __GXX_EXPERIMENTAL_CXX0X__
473 _Node* __p = this->_M_get_node();
476 _M_get_Tp_allocator().construct
477 (std::__addressof(__p->
_M_data), __x);
482 __throw_exception_again;
487 template<
typename... _Args>
491 _Node* __p = this->_M_get_node();
494 _M_get_Node_allocator().construct(__p,
495 std::forward<_Args>(__args)...);
500 __throw_exception_again;
520 list(
const allocator_type& __a)
523 #ifdef __GXX_EXPERIMENTAL_CXX0X__
534 { _M_default_initialize(__n); }
544 list(size_type __n,
const value_type& __value,
545 const allocator_type& __a = allocator_type())
547 { _M_fill_initialize(__n, __value); }
558 list(size_type __n,
const value_type& __value = value_type(),
559 const allocator_type& __a = allocator_type())
561 { _M_fill_initialize(__n, __value); }
572 :
_Base(__x._M_get_Node_allocator())
573 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
575 #ifdef __GXX_EXPERIMENTAL_CXX0X__
584 :
_Base(std::move(__x)) { }
595 const allocator_type& __a = allocator_type())
597 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
610 template<
typename _InputIterator>
611 list(_InputIterator __first, _InputIterator __last,
612 const allocator_type& __a = allocator_type())
616 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
617 _M_initialize_dispatch(__first, __last, _Integral());
638 #ifdef __GXX_EXPERIMENTAL_CXX0X__
666 this->
assign(__l.begin(), __l.end());
682 assign(size_type __n,
const value_type& __val)
683 { _M_fill_assign(__n, __val); }
697 template<
typename _InputIterator>
699 assign(_InputIterator __first, _InputIterator __last)
702 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
703 _M_assign_dispatch(__first, __last, _Integral());
706 #ifdef __GXX_EXPERIMENTAL_CXX0X__
716 { this->
assign(__l.begin(), __l.end()); }
722 {
return _Base::get_allocator(); }
731 {
return iterator(this->_M_impl._M_node._M_next); }
749 {
return iterator(&this->_M_impl._M_node); }
774 const_reverse_iterator
792 const_reverse_iterator
796 #ifdef __GXX_EXPERIMENTAL_CXX0X__
820 const_reverse_iterator
829 const_reverse_iterator
841 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
851 {
return _M_get_Node_allocator().max_size(); }
853 #ifdef __GXX_EXPERIMENTAL_CXX0X__
864 resize(size_type __new_size);
877 resize(size_type __new_size,
const value_type& __x);
890 resize(size_type __new_size, value_type __x = value_type());
947 { this->_M_insert(
begin(), __x); }
949 #ifdef __GXX_EXPERIMENTAL_CXX0X__
952 { this->_M_insert(
begin(), std::move(__x)); }
954 template<
typename... _Args>
956 emplace_front(_Args&&... __args)
957 { this->_M_insert(
begin(), std::forward<_Args>(__args)...); }
974 { this->_M_erase(
begin()); }
988 { this->_M_insert(
end(), __x); }
990 #ifdef __GXX_EXPERIMENTAL_CXX0X__
993 { this->_M_insert(
end(), std::move(__x)); }
995 template<
typename... _Args>
997 emplace_back(_Args&&... __args)
998 { this->_M_insert(
end(), std::forward<_Args>(__args)...); }
1014 { this->_M_erase(
iterator(this->_M_impl._M_node._M_prev)); }
1016 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1029 template<
typename... _Args>
1048 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1062 {
return emplace(__position, std::move(__x)); }
1079 { this->
insert(__p, __l.begin(), __l.end()); }
1097 list __tmp(__n, __x, _M_get_Node_allocator());
1098 splice(__position, __tmp);
1114 template<
typename _InputIterator>
1117 _InputIterator __last)
1119 list __tmp(__first, __last, _M_get_Node_allocator());
1120 splice(__position, __tmp);
1162 while (__first != __last)
1163 __first =
erase(__first);
1179 __detail::_List_node_base::swap(this->_M_impl._M_node,
1180 __x._M_impl._M_node);
1184 std::__alloc_swap<typename _Base::_Node_alloc_type>::
1185 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator());
1214 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1222 _M_check_equal_allocators(__x);
1224 this->_M_transfer(__position, __x.
begin(), __x.
end());
1228 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1231 {
splice(__position, std::move(__x)); }
1244 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1252 if (__position == __i || __position == __j)
1256 _M_check_equal_allocators(__x);
1258 this->_M_transfer(__position, __i, __j);
1261 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1264 {
splice(__position, std::move(__x), __i); }
1280 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1288 if (__first != __last)
1291 _M_check_equal_allocators(__x);
1293 this->_M_transfer(__position, __first, __last);
1297 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1300 {
splice(__position, std::move(__x), __first, __last); }
1315 remove(
const _Tp& __value);
1328 template<
typename _Predicate>
1357 template<
typename _BinaryPredicate>
1359 unique(_BinaryPredicate);
1370 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1376 {
merge(std::move(__x)); }
1394 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1395 template<
typename _StrictWeakOrdering>
1399 template<
typename _StrictWeakOrdering>
1401 merge(
list& __x, _StrictWeakOrdering __comp)
1402 {
merge(std::move(__x), __comp); }
1404 template<
typename _StrictWeakOrdering>
1416 { this->_M_impl._M_node._M_reverse(); }
1433 template<
typename _StrictWeakOrdering>
1435 sort(_StrictWeakOrdering);
1444 template<
typename _Integer>
1446 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1447 { _M_fill_initialize(static_cast<size_type>(__n), __x); }
1450 template<
typename _InputIterator>
1452 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1455 for (; __first != __last; ++__first)
1462 _M_fill_initialize(size_type __n,
const value_type& __x)
1468 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1471 _M_default_initialize(size_type __n)
1479 _M_default_append(size_type __n);
1488 template<
typename _Integer>
1490 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1491 { _M_fill_assign(__n, __val); }
1494 template<
typename _InputIterator>
1496 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1502 _M_fill_assign(size_type __n,
const value_type& __val);
1507 _M_transfer(iterator __position, iterator __first, iterator __last)
1508 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
1511 #ifndef __GXX_EXPERIMENTAL_CXX0X__
1513 _M_insert(iterator __position,
const value_type& __x)
1516 __tmp->_M_hook(__position._M_node);
1519 template<
typename... _Args>
1521 _M_insert(iterator __position, _Args&&... __args)
1524 __tmp->_M_hook(__position._M_node);
1530 _M_erase(iterator __position)
1532 __position._M_node->_M_unhook();
1533 _Node* __n =
static_cast<_Node*
>(__position._M_node);
1534 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1535 _M_get_Node_allocator().destroy(__n);
1537 _M_get_Tp_allocator().destroy(std::__addressof(__n->_M_data));
1544 _M_check_equal_allocators(
list& __x)
1546 if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
1547 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
1548 __throw_runtime_error(__N(
"list::_M_check_equal_allocators"));
1562 template<
typename _Tp,
typename _Alloc>
1567 const_iterator __end1 = __x.
end();
1568 const_iterator __end2 = __y.
end();
1570 const_iterator __i1 = __x.
begin();
1571 const_iterator __i2 = __y.
begin();
1572 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
1577 return __i1 == __end1 && __i2 == __end2;
1591 template<
typename _Tp,
typename _Alloc>
1595 __y.begin(), __y.end()); }
1598 template<
typename _Tp,
typename _Alloc>
1601 {
return !(__x == __y); }
1604 template<
typename _Tp,
typename _Alloc>
1607 {
return __y < __x; }
1610 template<
typename _Tp,
typename _Alloc>
1613 {
return !(__y < __x); }
1616 template<
typename _Tp,
typename _Alloc>
1619 {
return !(__x < __y); }
1622 template<
typename _Tp,
typename _Alloc>
1627 _GLIBCXX_END_NAMESPACE_CONTAINER
void assign(initializer_list< value_type > __l)
Assigns an initializer_list to a list.
const_iterator end() const
list(size_type __n)
Creates a list with default constructed elements.
void pop_back()
Removes last element.
Common part of a node in the list.
iterator insert(iterator __position, value_type &&__x)
Inserts given rvalue into list before specified iterator.
iterator erase(iterator __first, iterator __last)
Remove a range of elements.
void splice(iterator __position, list &&__x, iterator __first, iterator __last)
Insert range from another list.
void insert(iterator __position, _InputIterator __first, _InputIterator __last)
Inserts a range into the list.
const_iterator cend() const
void insert(iterator __p, initializer_list< value_type > __l)
Inserts the contents of an initializer_list into list before specified iterator.
iterator erase(iterator __position)
Remove element at given position.
list(const list &__x)
List copy constructor.
list(const allocator_type &__a)
Creates a list with no elements.
void splice(iterator __position, list &&__x)
Insert contents of another list.
list & operator=(list &&__x)
List move assignment operator.
_Tp _M_data
< User's data.
void sort()
Sort the elements.
void merge(list &&__x)
Merge sorted lists.
void resize(size_type __new_size)
Resizes the list to the specified number of elements.
const_reference back() const
reverse_iterator rbegin()
const_reverse_iterator crbegin() const
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a list.
list(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a list from an initializer_list.
void remove_if(_Predicate)
Remove all elements satisfying a predicate.
void splice(iterator __position, list &&__x, iterator __i)
Insert element from another list.
list(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a list from a range.
void push_back(const value_type &__x)
Add data to the end of the list.
void push_front(const value_type &__x)
Add data to the front of the list.
void assign(size_type __n, const value_type &__val)
Assigns a given value to a list.
_Node * _M_create_node(_Args &&...__args)
iterator emplace(iterator __position, _Args &&...__args)
Constructs object in list before specified iterator.
Bidirectional iterators support a superset of forward iterator operations.
void swap(list &__x)
Swaps data with another list.
iterator insert(iterator __position, const value_type &__x)
Inserts given value into list before specified iterator.
See bits/stl_deque.h's _Deque_base for an explanation.
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
void insert(iterator __position, size_type __n, const value_type &__x)
Inserts a number of copies of given data into the list.
size_type max_size() const
An actual node in the list.
list & operator=(const list &__x)
List assignment operator.
const_reverse_iterator crend() const
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
const_iterator cbegin() const
const_reference front() const
list()
Default constructor creates no elements.
list(list &&__x)
List move constructor.
list & operator=(initializer_list< value_type > __l)
List initializer list assignment operator.
void reverse()
Reverse the elements in list.
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
const_reverse_iterator rbegin() const
list(size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())
Creates a list with copies of an exemplar element.
allocator_type get_allocator() const
Get a copy of the memory allocation object.
const_iterator begin() const
void pop_front()
Removes first element.
_Tp && forward(typename std::remove_reference< _Tp >::type &__t)
forward (as per N3143)
const_reverse_iterator rend() const
void unique()
Remove consecutive duplicate elements.