29 #ifndef _GLIBCXX_PROFILE_LIST 
   30 #define _GLIBCXX_PROFILE_LIST 1 
   36 namespace std _GLIBCXX_VISIBILITY(default)
 
   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;
 
   68       list(
const _Allocator& __a = _Allocator())
 
   71         __profcxx_list_construct(
this);     
 
   72         __profcxx_list_construct2(
this);    
 
   75 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
   80         __profcxx_list_construct(
this); 
 
   81         __profcxx_list_construct2(
this); 
 
   84       list(size_type __n, 
const _Tp& __value,
 
   85        const _Allocator& __a = _Allocator())
 
   86       : 
_Base(__n, __value, __a) 
 
   88         __profcxx_list_construct(
this); 
 
   89         __profcxx_list_construct2(
this); 
 
   93       list(size_type __n, 
const _Tp& __value = _Tp(),
 
   94        const _Allocator& __a = _Allocator())
 
   95       : 
_Base(__n, __value, __a) 
 
   97         __profcxx_list_construct(
this); 
 
   98         __profcxx_list_construct2(
this); 
 
  102       template<
class _InputIterator>
 
  103       list(_InputIterator __first, _InputIterator __last,
 
  104        const _Allocator& __a = _Allocator())
 
  105       : 
_Base(__first, __last, __a)
 
  107         __profcxx_list_construct(
this); 
 
  108         __profcxx_list_construct2(
this); 
 
  114         __profcxx_list_construct(
this); 
 
  115         __profcxx_list_construct2(
this); 
 
  121         __profcxx_list_construct(
this); 
 
  122         __profcxx_list_construct2(
this); 
 
  125 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  127       : 
_Base(std::move(__x))
 
  129         __profcxx_list_construct(
this); 
 
  130         __profcxx_list_construct2(
this); 
 
  134            const allocator_type& __a = allocator_type())
 
  135         : 
_Base(__l, __a) { }
 
  139         __profcxx_list_destruct(
this); 
 
  140         __profcxx_list_destruct2(
this); 
 
  144       operator=(
const list& __x)
 
  146     static_cast<_Base&
>(*this) = __x;
 
  150 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  152       operator=(
list&& __x)
 
  164     static_cast<_Base&
>(*this) = __l;
 
  170       { _Base::assign(__l); }
 
  173       template<
class _InputIterator>
 
  175         assign(_InputIterator __first, _InputIterator __last)
 
  176         { _Base::assign(__first, __last); }
 
  179       assign(size_type __n, 
const _Tp& __t)
 
  180       { _Base::assign(__n, __t); }
 
  182       using _Base::get_allocator;
 
  187       { 
return iterator(_Base::begin(), 
this); }
 
  191       { 
return const_iterator(_Base::begin(), 
this); }
 
  196         __profcxx_list_rewind(
this);
 
  197         return iterator(_Base::end(), 
this);
 
  203         __profcxx_list_rewind(
this);
 
  204         return const_iterator(_Base::end(), 
this);
 
  210         __profcxx_list_rewind(
this);
 
  217         __profcxx_list_rewind(
this);
 
  229 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  232       { 
return const_iterator(_Base::begin(), 
this); }
 
  236       { 
return const_iterator(_Base::end(), 
this); }
 
  250       using _Base::max_size;
 
  252 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  254       resize(size_type __sz)
 
  255       { _Base::resize(__sz); }
 
  258       resize(size_type __sz, 
const _Tp& __c)
 
  259       { _Base::resize(__sz, __c); }
 
  262       resize(size_type __sz, _Tp __c = _Tp())
 
  263       { _Base::resize(__sz, __c); }
 
  269       { 
return _Base::front(); }
 
  273       { 
return _Base::front(); }
 
  278         __profcxx_list_rewind(
this);
 
  279     return _Base::back();
 
  285         __profcxx_list_rewind(
this);
 
  286     return _Base::back();
 
  291       push_front(
const value_type& __x)
 
  293         __profcxx_list_invalid_operator(
this);
 
  294         __profcxx_list_operation(
this);
 
  295         _Base::push_front(__x);
 
  298 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  299       using _Base::emplace_front;
 
  305         __profcxx_list_operation(
this);
 
  309       using _Base::push_back;
 
  311 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  312       using _Base::emplace_back;
 
  318     iterator __victim = end();
 
  321         __profcxx_list_rewind(
this);
 
  324 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  325       template<
typename... _Args>
 
  327         emplace(iterator __position, _Args&&... __args)
 
  329       return iterator(_Base::emplace(__position.base(),
 
  330                                          std::forward<_Args>(__args)...));
 
  335       insert(iterator __position, 
const _Tp& __x)
 
  337         _M_profile_insert(
this, __position, 
size());
 
  338         return iterator(_Base::insert(__position.base(), __x), 
this);
 
  341 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  343       insert(iterator __position, _Tp&& __x)
 
  345         _M_profile_insert(
this, __position, 
size());
 
  346         return iterator(_Base::emplace(__position.base(), std::move(__x)),
 
  353         _M_profile_insert(
this, __position, 
size());
 
  354         _Base::insert(__position.base(), __l);
 
  359       insert(iterator __position, size_type __n, 
const _Tp& __x)
 
  361         _M_profile_insert(
this, __position, 
size());
 
  362     _Base::insert(__position.base(), __n, __x);
 
  365       template<
class _InputIterator>
 
  367         insert(iterator __position, _InputIterator __first,
 
  368            _InputIterator __last)
 
  370         _M_profile_insert(
this, __position, 
size());
 
  371         _Base::insert(__position.base(), __first, __last);
 
  375       erase(iterator __position)
 
  376       { 
return iterator(_Base::erase(__position.base()), 
this); }
 
  379       erase(iterator __position, iterator __last)
 
  383     return iterator(_Base::erase(__position.base(), __last.base()), 
this);
 
  388       { _Base::swap(__x); }
 
  396 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  397       splice(iterator __position, 
list&& __x)
 
  399       splice(iterator __position, 
list& __x)
 
  401       { this->splice(__position, _GLIBCXX_MOVE(__x), __x.begin(), __x.end()); }
 
  403 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  405       splice(iterator __position, 
list& __x)
 
  406       { this->splice(__position, std::move(__x)); }
 
  409 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  411       splice(iterator __position, 
list& __x, iterator __i)
 
  412       { this->splice(__position, std::move(__x), __i); }
 
  416 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  417       splice(iterator __position, 
list&& __x, iterator __i)
 
  419       splice(iterator __position, 
list& __x, iterator __i)
 
  426     _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
 
  431 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  432       splice(iterator __position, 
list&& __x, iterator __first,
 
  435       splice(iterator __position, 
list& __x, iterator __first,
 
  442     _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
 
  443               __first.base(), __last.base());
 
  446 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  448       splice(iterator __position, 
list& __x, iterator __first, iterator __last)
 
  449       { this->splice(__position, std::move(__x), __first, __last); }
 
  453       remove(
const _Tp& __value)
 
  455     for (iterator __x = begin(); __x != end(); )
 
  464       template<
class _Predicate>
 
  466         remove_if(_Predicate __pred)
 
  468       for (iterator __x = begin(); __x != end(); )
 
  470               __profcxx_list_operation(
this);
 
  481     iterator __first = begin();
 
  482     iterator __last = end();
 
  483     if (__first == __last)
 
  485     iterator __next = __first;
 
  486     while (++__next != __last)
 
  488             __profcxx_list_operation(
this);
 
  489         if (*__first == *__next)
 
  497       template<
class _BinaryPredicate>
 
  499         unique(_BinaryPredicate __binary_pred)
 
  501       iterator __first = begin();
 
  502       iterator __last = end();
 
  503       if (__first == __last)
 
  505       iterator __next = __first;
 
  506       while (++__next != __last)
 
  508               __profcxx_list_operation(
this);
 
  509           if (__binary_pred(*__first, *__next))
 
  518 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  527       { _Base::merge(_GLIBCXX_MOVE(__x._M_base())); }
 
  530 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  533       { this->merge(std::move(__x)); }
 
  536       template<
class _Compare>
 
  538 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  539         merge(
list&& __x, _Compare __comp)
 
  541         merge(
list& __x, _Compare __comp)
 
  547         { _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); }
 
  550 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  551       template<
typename _Compare>
 
  553         merge(
list& __x, _Compare __comp)
 
  554         { this->merge(std::move(__x), __comp); }
 
  558       sort() { _Base::sort(); }
 
  560       template<
typename _StrictWeakOrdering>
 
  562         sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); }
 
  564       using _Base::reverse;
 
  567       _M_base()       { 
return *
this; }
 
  570       _M_base()
 const { 
return *
this; }
 
  572       inline void _M_profile_find()
 const  
  575       inline void _M_profile_iterate(
int __rewind = 0)
 const  
  577         __profcxx_list_operation(
this);
 
  578         __profcxx_list_iterate(
this); 
 
  580           __profcxx_list_rewind(
this);
 
  584       size_type _M_profile_insert(
void* obj, iterator __pos, size_type __size)
 
  586         size_type __shift = 0;
 
  587         typename _Base::iterator __it = __pos.base();
 
  588         for ( ; __it!=_Base::end(); __it++)
 
  590         __profcxx_list_rewind(
this);
 
  591         __profcxx_list_operation(
this);
 
  592         __profcxx_list_insert(
this, __shift, __size);
 
  596   template<
typename _Tp, 
typename _Alloc>
 
  600     { 
return __lhs._M_base() == __rhs._M_base(); }
 
  602   template<
typename _Tp, 
typename _Alloc>
 
  606     { 
return __lhs._M_base() != __rhs._M_base(); }
 
  608   template<
typename _Tp, 
typename _Alloc>
 
  610     operator<(const list<_Tp, _Alloc>& __lhs,
 
  611           const list<_Tp, _Alloc>& __rhs)
 
  612     { 
return __lhs._M_base() < __rhs._M_base(); }
 
  614   template<
typename _Tp, 
typename _Alloc>
 
  616     operator<=(const list<_Tp, _Alloc>& __lhs,
 
  617            const list<_Tp, _Alloc>& __rhs)
 
  618     { 
return __lhs._M_base() <= __rhs._M_base(); }
 
  620   template<
typename _Tp, 
typename _Alloc>
 
  622     operator>=(
const list<_Tp, _Alloc>& __lhs,
 
  623            const list<_Tp, _Alloc>& __rhs)
 
  624     { 
return __lhs._M_base() >= __rhs._M_base(); }
 
  626   template<
typename _Tp, 
typename _Alloc>
 
  628     operator>(
const list<_Tp, _Alloc>& __lhs,
 
  629           const list<_Tp, _Alloc>& __rhs)
 
  630     { 
return __lhs._M_base() > __rhs._M_base(); }
 
  632   template<
typename _Tp, 
typename _Alloc>
 
  634     swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
 
  635     { __lhs.swap(__rhs); }