List wrapper with performance instrumentation.
41 template<
typename _Tp,
typename _Allocator = std::allocator<_Tp> >
43 :
public _GLIBCXX_STD_C::list<_Tp, _Allocator>
45 typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base;
48 typedef typename _Base::reference reference;
49 typedef typename _Base::const_reference const_reference;
51 typedef __iterator_tracker<typename _Base::iterator, list>
53 typedef __iterator_tracker<typename _Base::const_iterator, list>
56 typedef typename _Base::size_type size_type;
57 typedef typename _Base::difference_type difference_type;
59 typedef _Tp value_type;
60 typedef _Allocator allocator_type;
61 typedef typename _Base::pointer pointer;
62 typedef typename _Base::const_pointer const_pointer;
63 typedef std::reverse_iterator<iterator> reverse_iterator;
64 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
68 list(
const _Allocator& __a = _Allocator())
75 #if __cplusplus >= 201103L
84 list(size_type __n,
const _Tp& __value,
85 const _Allocator& __a = _Allocator())
86 : _Base(__n, __value, __a)
93 list(size_type __n,
const _Tp& __value = _Tp(),
94 const _Allocator& __a = _Allocator())
95 : _Base(__n, __value, __a)
102 #if __cplusplus >= 201103L
103 template<
typename _InputIterator,
104 typename = std::_RequireInputIter<_InputIterator>>
106 template<
class _InputIterator>
108 list(_InputIterator __first, _InputIterator __last,
109 const _Allocator& __a = _Allocator())
110 : _Base(__first, __last, __a)
116 list(
const list& __x)
123 list(
const _Base& __x)
130 #if __cplusplus >= 201103L
131 list(list&& __x) noexcept
132 : _Base(std::move(__x))
138 list(initializer_list<value_type> __l,
139 const allocator_type& __a = allocator_type())
140 : _Base(__l, __a) { }
143 ~list() _GLIBCXX_NOEXCEPT
150 operator=(
const list& __x)
152 static_cast<_Base&
>(*this) = __x;
156 #if __cplusplus >= 201103L
158 operator=(list&& __x)
168 operator=(initializer_list<value_type> __l)
170 static_cast<_Base&
>(*this) = __l;
175 assign(initializer_list<value_type> __l)
176 { _Base::assign(__l); }
179 #if __cplusplus >= 201103L
180 template<
typename _InputIterator,
181 typename = std::_RequireInputIter<_InputIterator>>
183 template<
class _InputIterator>
186 assign(_InputIterator __first, _InputIterator __last)
187 { _Base::assign(__first, __last); }
190 assign(size_type __n,
const _Tp& __t)
191 { _Base::assign(__n, __t); }
193 using _Base::get_allocator;
197 begin() _GLIBCXX_NOEXCEPT
198 {
return iterator(_Base::begin(),
this); }
201 begin() const _GLIBCXX_NOEXCEPT
202 {
return const_iterator(_Base::begin(),
this); }
205 end() _GLIBCXX_NOEXCEPT
208 return iterator(_Base::end(),
this);
212 end() const _GLIBCXX_NOEXCEPT
215 return const_iterator(_Base::end(),
this);
219 rbegin() _GLIBCXX_NOEXCEPT
222 return reverse_iterator(end());
225 const_reverse_iterator
226 rbegin() const _GLIBCXX_NOEXCEPT
229 return const_reverse_iterator(end());
233 rend() _GLIBCXX_NOEXCEPT
234 {
return reverse_iterator(begin()); }
236 const_reverse_iterator
237 rend() const _GLIBCXX_NOEXCEPT
238 {
return const_reverse_iterator(begin()); }
240 #if __cplusplus >= 201103L
242 cbegin() const noexcept
243 {
return const_iterator(_Base::begin(),
this); }
246 cend() const noexcept
247 {
return const_iterator(_Base::end(),
this); }
249 const_reverse_iterator
250 crbegin() const noexcept
251 {
return const_reverse_iterator(end()); }
253 const_reverse_iterator
254 crend() const noexcept
255 {
return const_reverse_iterator(begin()); }
261 using _Base::max_size;
263 #if __cplusplus >= 201103L
265 resize(size_type __sz)
266 { _Base::resize(__sz); }
269 resize(size_type __sz,
const _Tp& __c)
270 { _Base::resize(__sz, __c); }
273 resize(size_type __sz, _Tp __c = _Tp())
274 { _Base::resize(__sz, __c); }
280 {
return _Base::front(); }
284 {
return _Base::front(); }
290 return _Base::back();
297 return _Base::back();
302 push_front(
const value_type& __x)
306 _Base::push_front(__x);
309 #if __cplusplus >= 201103L
310 using _Base::emplace_front;
320 using _Base::push_back;
322 #if __cplusplus >= 201103L
323 using _Base::emplace_back;
329 iterator __victim = end();
335 #if __cplusplus >= 201103L
336 template<
typename... _Args>
338 emplace(iterator __position, _Args&&... __args)
340 return iterator(_Base::emplace(__position.base(),
341 std::forward<_Args>(__args)...),
347 insert(iterator __position,
const _Tp& __x)
349 _M_profile_insert(
this, __position, size());
350 return iterator(_Base::insert(__position.base(), __x),
this);
353 #if __cplusplus >= 201103L
355 insert(iterator __position, _Tp&& __x)
357 _M_profile_insert(
this, __position, size());
358 return iterator(_Base::emplace(__position.base(), std::move(__x)),
363 insert(iterator __position, initializer_list<value_type> __l)
365 _M_profile_insert(
this, __position, size());
366 _Base::insert(__position.base(), __l);
371 insert(iterator __position, size_type __n,
const _Tp& __x)
373 _M_profile_insert(
this, __position, size());
374 _Base::insert(__position.base(), __n, __x);
377 #if __cplusplus >= 201103L
378 template<
typename _InputIterator,
379 typename = std::_RequireInputIter<_InputIterator>>
381 template<
class _InputIterator>
384 insert(iterator __position, _InputIterator __first,
385 _InputIterator __last)
387 _M_profile_insert(
this, __position, size());
388 _Base::insert(__position.base(), __first, __last);
392 erase(iterator __position)
393 {
return iterator(_Base::erase(__position.base()),
this); }
396 erase(iterator __position, iterator __last)
400 return iterator(_Base::erase(__position.base(), __last.base()),
this);
408 clear() _GLIBCXX_NOEXCEPT
413 #if __cplusplus >= 201103L
414 splice(iterator __position, list&& __x)
416 splice(iterator __position, list& __x)
418 { this->splice(__position,
_GLIBCXX_MOVE(__x), __x.begin(), __x.end()); }
420 #if __cplusplus >= 201103L
422 splice(iterator __position, list& __x)
423 { this->splice(__position, std::move(__x)); }
426 #if __cplusplus >= 201103L
428 splice(iterator __position, list& __x, iterator __i)
429 { this->splice(__position, std::move(__x), __i); }
433 #if __cplusplus >= 201103L
434 splice(iterator __position, list&& __x, iterator __i)
436 splice(iterator __position, list& __x, iterator __i)
443 _Base::splice(__position.base(),
_GLIBCXX_MOVE(__x._M_base()),
448 #if __cplusplus >= 201103L
449 splice(iterator __position, list&& __x, iterator __first,
452 splice(iterator __position, list& __x, iterator __first,
459 _Base::splice(__position.base(),
_GLIBCXX_MOVE(__x._M_base()),
460 __first.base(), __last.base());
463 #if __cplusplus >= 201103L
465 splice(iterator __position, list& __x, iterator __first, iterator __last)
466 { this->splice(__position, std::move(__x), __first, __last); }
470 remove(
const _Tp& __value)
472 for (iterator __x = begin(); __x != end(); )
481 template<
class _Predicate>
483 remove_if(_Predicate __pred)
485 for (iterator __x = begin(); __x != end(); )
498 iterator __first = begin();
499 iterator __last = end();
500 if (__first == __last)
502 iterator __next = __first;
503 while (++__next != __last)
506 if (*__first == *__next)
514 template<
class _BinaryPredicate>
516 unique(_BinaryPredicate __binary_pred)
518 iterator __first = begin();
519 iterator __last = end();
520 if (__first == __last)
522 iterator __next = __first;
523 while (++__next != __last)
526 if (__binary_pred(*__first, *__next))
535 #if __cplusplus >= 201103L
547 #if __cplusplus >= 201103L
550 { this->merge(std::move(__x)); }
553 template<
class _Compare>
555 #if __cplusplus >= 201103L
556 merge(list&& __x, _Compare __comp)
558 merge(list& __x, _Compare __comp)
567 #if __cplusplus >= 201103L
568 template<
typename _Compare>
570 merge(list& __x, _Compare __comp)
571 { this->merge(std::move(__x), __comp); }
575 sort() { _Base::sort(); }
577 template<
typename _StrictWeakOrdering>
579 sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); }
581 using _Base::reverse;
584 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
587 _M_base() const _GLIBCXX_NOEXCEPT {
return *
this; }
589 void _M_profile_find()
const
592 void _M_profile_iterate(
int __rewind = 0)
const
601 size_type _M_profile_insert(
void* obj, iterator __pos, size_type
__size)
603 size_type __shift = 0;
604 typename _Base::iterator __it = __pos.base();
605 for ( ; __it!=_Base::end(); __it++)
613 template<
typename _Tp,
typename _Alloc>
616 const list<_Tp, _Alloc>& __rhs)
617 {
return __lhs._M_base() == __rhs._M_base(); }
619 template<
typename _Tp,
typename _Alloc>
622 const list<_Tp, _Alloc>& __rhs)
623 {
return __lhs._M_base() != __rhs._M_base(); }
625 template<
typename _Tp,
typename _Alloc>
627 operator<(const list<_Tp, _Alloc>& __lhs,
628 const list<_Tp, _Alloc>& __rhs)
629 {
return __lhs._M_base() < __rhs._M_base(); }
631 template<
typename _Tp,
typename _Alloc>
633 operator<=(const list<_Tp, _Alloc>& __lhs,
634 const list<_Tp, _Alloc>& __rhs)
635 {
return __lhs._M_base() <= __rhs._M_base(); }
637 template<
typename _Tp,
typename _Alloc>
640 const list<_Tp, _Alloc>& __rhs)
641 {
return __lhs._M_base() >= __rhs._M_base(); }
643 template<
typename _Tp,
typename _Alloc>
645 operator>(
const list<_Tp, _Alloc>& __lhs,
646 const list<_Tp, _Alloc>& __rhs)
647 {
return __lhs._M_base() > __rhs._M_base(); }
649 template<
typename _Tp,
typename _Alloc>
651 swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
652 { __lhs.swap(__rhs); }
#define __profcxx_list_rewind(__x...)
Definition: profiler.h:327
bool operator>=(const _Safe_iterator< _IteratorL, _Sequence > &__lhs, const _Safe_iterator< _IteratorR, _Sequence > &__rhs)
Definition: safe_iterator.h:644
#define _GLIBCXX_MOVE(__val)
Definition: move.h:145
bool operator==(const exception_ptr &, const exception_ptr &) _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
std::size_t __size(__stack_t __stack)
Definition: profiler_node.h:68
#define __profcxx_list_construct(__x...)
Definition: profiler.h:330
bool operator>(const _Safe_iterator< _IteratorL, _Sequence > &__lhs, const _Safe_iterator< _IteratorR, _Sequence > &__rhs)
Definition: safe_iterator.h:612
#define __profcxx_list_destruct2(__x...)
Definition: profiler.h:305
bool operator!=(const exception_ptr &, const exception_ptr &) _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
#define __profcxx_list_operation(__x...)
Definition: profiler.h:328
#define __profcxx_list_insert(__x...)
Definition: profiler.h:307
#define __profcxx_list_construct2(__x...)
Definition: profiler.h:306
void swap(exception_ptr &__lhs, exception_ptr &__rhs)
Definition: exception_ptr.h:160
#define __profcxx_list_invalid_operator(__x...)
Definition: profiler.h:309
#define __profcxx_list_destruct(__x...)
Definition: profiler.h:329
#define __profcxx_list_iterate(__x...)
Definition: profiler.h:308