60 #ifndef _STL_ITERATOR_BASE_FUNCS_H
61 #define _STL_ITERATOR_BASE_FUNCS_H 1
63 #pragma GCC system_header
67 namespace std _GLIBCXX_VISIBILITY(default)
69 _GLIBCXX_BEGIN_NAMESPACE_VERSION
71 template<
typename _InputIterator>
72 inline typename iterator_traits<_InputIterator>::difference_type
73 __distance(_InputIterator __first, _InputIterator __last,
77 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
79 typename iterator_traits<_InputIterator>::difference_type __n = 0;
80 while (__first != __last)
88 template<
typename _RandomAccessIterator>
89 inline typename iterator_traits<_RandomAccessIterator>::difference_type
90 __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
91 random_access_iterator_tag)
94 __glibcxx_function_requires(_RandomAccessIteratorConcept<
95 _RandomAccessIterator>)
96 return __last - __first;
112 template<typename _InputIterator>
113 inline typename iterator_traits<_InputIterator>::difference_type
114 distance(_InputIterator __first, _InputIterator __last)
117 return std::__distance(__first, __last,
121 template<
typename _InputIterator,
typename _Distance>
123 __advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
126 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
131 template<typename _BidirectionalIterator, typename _Distance>
133 __advance(_BidirectionalIterator& __i, _Distance __n,
134 bidirectional_iterator_tag)
137 __glibcxx_function_requires(_BidirectionalIteratorConcept<
138 _BidirectionalIterator>)
147 template<typename _RandomAccessIterator, typename _Distance>
149 __advance(_RandomAccessIterator& __i, _Distance __n,
150 random_access_iterator_tag)
153 __glibcxx_function_requires(_RandomAccessIteratorConcept<
154 _RandomAccessIterator>)
170 template<typename _InputIterator, typename _Distance>
175 typename iterator_traits<_InputIterator>::difference_type __d = __n;
179 #ifdef __GXX_EXPERIMENTAL_CXX0X__
181 template<
typename _ForwardIterator>
182 inline _ForwardIterator
183 next(_ForwardIterator __x,
typename
184 iterator_traits<_ForwardIterator>::difference_type __n = 1)
190 template<
typename _B
idirectionalIterator>
191 inline _BidirectionalIterator
192 prev(_BidirectionalIterator __x,
typename
193 iterator_traits<_BidirectionalIterator>::difference_type __n = 1)
199 #endif // __GXX_EXPERIMENTAL_CXX0X__
201 _GLIBCXX_END_NAMESPACE_VERSION
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)