59 #ifndef _STL_ITERATOR_BASE_TYPES_H
60 #define _STL_ITERATOR_BASE_TYPES_H 1
62 #pragma GCC system_header
66 #if __cplusplus >= 201103L
70 namespace std _GLIBCXX_VISIBILITY(default)
72 _GLIBCXX_BEGIN_NAMESPACE_VERSION
116 template<
typename _Category,
typename _Tp,
typename _Distance = ptrdiff_t,
117 typename _Pointer = _Tp*,
typename _Reference = _Tp&>
140 #if __cplusplus >= 201103L
142 _GLIBCXX_HAS_NESTED_TYPE(iterator_category)
144 template<typename _Iterator,
145 bool = __has_iterator_category<_Iterator>::value>
146 struct __iterator_traits { };
148 template<
typename _Iterator>
149 struct __iterator_traits<_Iterator, true>
151 typedef typename _Iterator::iterator_category iterator_category;
152 typedef typename _Iterator::value_type value_type;
153 typedef typename _Iterator::difference_type difference_type;
154 typedef typename _Iterator::pointer pointer;
155 typedef typename _Iterator::reference reference;
158 template<
typename _Iterator>
159 struct iterator_traits
160 :
public __iterator_traits<_Iterator> { };
162 template<
typename _Iterator>
163 struct iterator_traits
165 typedef typename _Iterator::iterator_category iterator_category;
166 typedef typename _Iterator::value_type value_type;
167 typedef typename _Iterator::difference_type difference_type;
168 typedef typename _Iterator::pointer pointer;
169 typedef typename _Iterator::reference reference;
174 template<
typename _Tp>
175 struct iterator_traits<_Tp*>
178 typedef _Tp value_type;
179 typedef ptrdiff_t difference_type;
180 typedef _Tp* pointer;
181 typedef _Tp& reference;
185 template<
typename _Tp>
186 struct iterator_traits<const _Tp*>
189 typedef _Tp value_type;
190 typedef ptrdiff_t difference_type;
191 typedef const _Tp* pointer;
192 typedef const _Tp& reference;
199 template<
typename _Iter>
200 inline typename iterator_traits<_Iter>::iterator_category
202 {
return typename iterator_traits<_Iter>::iterator_category(); }
208 template<
typename _Iterator,
bool _HasBase>
211 typedef _Iterator iterator_type;
212 static iterator_type _S_base(_Iterator __it)
216 template<
typename _Iterator>
217 struct _Iter_base<_Iterator, true>
219 typedef typename _Iterator::iterator_type iterator_type;
220 static iterator_type _S_base(_Iterator __it)
221 {
return __it.base(); }
224 #if __cplusplus >= 201103L
225 template<
typename _InIter>
226 using _RequireInputIter =
typename
227 enable_if<is_convertible<
typename
228 iterator_traits<_InIter>::iterator_category,
229 input_iterator_tag>::value>::type;
232 _GLIBCXX_END_NAMESPACE_VERSION
Forward iterators support a superset of input iterator operations.
_Category iterator_category
One of the tag types.
Random-access iterators support a superset of bidirectional iterator operations.
_Reference reference
This type represents a reference-to-value_type.
_Tp value_type
The type "pointed to" by the iterator.
Bidirectional iterators support a superset of forward iterator operations.
iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
Marking output iterators.
_Pointer pointer
This type represents a pointer-to-value_type.
_Distance difference_type
Distance between iterators is represented as this type.