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;
111 template<typename _InputIterator>
112 inline typename iterator_traits<_InputIterator>::difference_type
113 distance(_InputIterator __first, _InputIterator __last)
116 return std::__distance(__first, __last,
120 template<
typename _InputIterator,
typename _Distance>
122 __advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
125 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
130 template<typename _BidirectionalIterator, typename _Distance>
132 __advance(_BidirectionalIterator& __i, _Distance __n,
133 bidirectional_iterator_tag)
136 __glibcxx_function_requires(_BidirectionalIteratorConcept<
137 _BidirectionalIterator>)
146 template<typename _RandomAccessIterator, typename _Distance>
148 __advance(_RandomAccessIterator& __i, _Distance __n,
149 random_access_iterator_tag)
152 __glibcxx_function_requires(_RandomAccessIteratorConcept<
153 _RandomAccessIterator>)
169 template<typename _InputIterator, typename _Distance>
174 typename iterator_traits<_InputIterator>::difference_type __d = __n;
178 #ifdef __GXX_EXPERIMENTAL_CXX0X__
180 template<
typename _ForwardIterator>
181 inline _ForwardIterator
182 next(_ForwardIterator __x,
typename
183 iterator_traits<_ForwardIterator>::difference_type __n = 1)
189 template<
typename _B
idirectionalIterator>
190 inline _BidirectionalIterator
191 prev(_BidirectionalIterator __x,
typename
192 iterator_traits<_BidirectionalIterator>::difference_type __n = 1)
198 #endif // __GXX_EXPERIMENTAL_CXX0X__
200 _GLIBCXX_END_NAMESPACE_VERSION