59 #ifndef _STL_ITERATOR_BASE_FUNCS_H 60 #define _STL_ITERATOR_BASE_FUNCS_H 1 62 #pragma GCC system_header 67 namespace std _GLIBCXX_VISIBILITY(default)
69 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
73 _GLIBCXX_END_NAMESPACE_CONTAINER
75 _GLIBCXX_BEGIN_NAMESPACE_VERSION
77 template<
typename _InputIterator>
78 inline _GLIBCXX14_CONSTEXPR
79 typename iterator_traits<_InputIterator>::difference_type
80 __distance(_InputIterator __first, _InputIterator __last,
84 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
86 typename iterator_traits<_InputIterator>::difference_type __n = 0;
87 while (__first != __last)
95 template<
typename _RandomAccessIterator>
96 inline _GLIBCXX14_CONSTEXPR
97 typename iterator_traits<_RandomAccessIterator>::difference_type
98 __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
102 __glibcxx_function_requires(_RandomAccessIteratorConcept<
103 _RandomAccessIterator>)
104 return __last - __first;
107 #if _GLIBCXX_USE_CXX11_ABI 109 template<
typename _Tp>
111 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp>,
112 _GLIBCXX_STD_C::_List_iterator<_Tp>,
115 template<
typename _Tp>
117 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp>,
118 _GLIBCXX_STD_C::_List_const_iterator<_Tp>,
135 template<
typename _InputIterator>
136 inline _GLIBCXX17_CONSTEXPR
137 typename iterator_traits<_InputIterator>::difference_type
138 distance(_InputIterator __first, _InputIterator __last)
141 return std::__distance(__first, __last,
145 template<
typename _InputIterator,
typename _Distance>
146 inline _GLIBCXX14_CONSTEXPR
void 150 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
151 __glibcxx_assert(__n >= 0);
156 template<
typename _B
idirectionalIterator,
typename _Distance>
157 inline _GLIBCXX14_CONSTEXPR
void 158 __advance(_BidirectionalIterator& __i, _Distance __n,
162 __glibcxx_function_requires(_BidirectionalIteratorConcept<
163 _BidirectionalIterator>)
172 template<
typename _RandomAccessIterator,
typename _Distance>
173 inline _GLIBCXX14_CONSTEXPR
void 174 __advance(_RandomAccessIterator& __i, _Distance __n,
178 __glibcxx_function_requires(_RandomAccessIteratorConcept<
179 _RandomAccessIterator>)
195 template<
typename _InputIterator,
typename _Distance>
196 inline _GLIBCXX17_CONSTEXPR
void 200 typename iterator_traits<_InputIterator>::difference_type __d = __n;
204 #if __cplusplus >= 201103L 206 template<
typename _ForwardIterator>
207 inline _GLIBCXX17_CONSTEXPR _ForwardIterator
208 next(_ForwardIterator __x,
typename 209 iterator_traits<_ForwardIterator>::difference_type __n = 1)
212 __glibcxx_function_requires(_ForwardIteratorConcept<
218 template<
typename _B
idirectionalIterator>
219 inline _GLIBCXX17_CONSTEXPR _BidirectionalIterator
220 prev(_BidirectionalIterator __x,
typename 221 iterator_traits<_BidirectionalIterator>::difference_type __n = 1)
224 __glibcxx_function_requires(_BidirectionalIteratorConcept<
225 _BidirectionalIterator>)
232 _GLIBCXX_END_NAMESPACE_VERSION
iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
ISO C++ entities toplevel namespace is std.
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
_GLIBCXX17_CONSTEXPR void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
Random-access iterators support a superset of bidirectional iterator operations.
Bidirectional iterators support a superset of forward iterator operations.