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 #if __cplusplus > 201703L && __cpp_concepts >= 201907L
74 namespace std _GLIBCXX_VISIBILITY(default)
76 _GLIBCXX_BEGIN_NAMESPACE_VERSION
109 #if __cplusplus > 201703L
125 template<
typename _Category,
typename _Tp,
typename _Distance = ptrdiff_t,
126 typename _Pointer = _Tp*,
typename _Reference = _Tp&>
149 template<
typename _Iterator>
152 #if __cplusplus >= 201103L
155 template<
typename _Iterator,
typename = __
void_t<>>
156 struct __iterator_traits { };
158 #if ! __cpp_lib_concepts
160 template<
typename _Iterator>
161 struct __iterator_traits<_Iterator,
162 __void_t<typename _Iterator::iterator_category,
163 typename _Iterator::value_type,
164 typename _Iterator::difference_type,
165 typename _Iterator::pointer,
166 typename _Iterator::reference>>
168 typedef typename _Iterator::iterator_category iterator_category;
169 typedef typename _Iterator::value_type value_type;
170 typedef typename _Iterator::difference_type difference_type;
171 typedef typename _Iterator::pointer pointer;
172 typedef typename _Iterator::reference reference;
176 template<
typename _Iterator>
178 :
public __iterator_traits<_Iterator> { };
181 template<
typename _Iterator>
184 typedef typename _Iterator::iterator_category iterator_category;
185 typedef typename _Iterator::value_type value_type;
186 typedef typename _Iterator::difference_type difference_type;
187 typedef typename _Iterator::pointer pointer;
188 typedef typename _Iterator::reference reference;
192 #if __cplusplus > 201703L
194 template<
typename _Tp>
195 #if __cpp_concepts >= 201907L
196 requires is_object_v<_Tp>
203 using difference_type = ptrdiff_t;
204 using pointer = _Tp*;
205 using reference = _Tp&;
209 template<
typename _Tp>
213 typedef _Tp value_type;
214 typedef ptrdiff_t difference_type;
215 typedef _Tp* pointer;
216 typedef _Tp& reference;
220 template<
typename _Tp>
221 struct iterator_traits<const _Tp*>
223 typedef random_access_iterator_tag iterator_category;
224 typedef _Tp value_type;
225 typedef ptrdiff_t difference_type;
226 typedef const _Tp* pointer;
227 typedef const _Tp& reference;
235 template<
typename _Iter>
236 inline _GLIBCXX_CONSTEXPR
237 typename iterator_traits<_Iter>::iterator_category
243 #if __cplusplus >= 201103L
244 template<
typename _Iter>
245 using __iterator_category_t
246 =
typename iterator_traits<_Iter>::iterator_category;
248 template<
typename _InIter>
249 using _RequireInputIter =
250 __enable_if_t<is_convertible<__iterator_category_t<_InIter>,
251 input_iterator_tag>::value>;
253 template<
typename _It,
254 typename _Cat = __iterator_category_t<_It>>
255 struct __is_random_access_iter
256 : is_base_of<random_access_iterator_tag, _Cat>
258 typedef is_base_of<random_access_iterator_tag, _Cat> _Base;
259 enum { __value = _Base::value };
262 template<
typename _It,
typename _Traits = iterator_traits<_It>,
263 typename _Cat =
typename _Traits::iterator_category>
264 struct __is_random_access_iter
265 {
enum { __value = __is_base_of(random_access_iterator_tag, _Cat) }; };
268 _GLIBCXX_END_NAMESPACE_VERSION
typename remove_cv< _Tp >::type remove_cv_t
Alias template for remove_cv.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
ISO C++ entities toplevel namespace is std.
Traits class for iterators.
Marking output iterators.
Forward iterators support a superset of input iterator operations.
Bidirectional iterators support a superset of forward iterator operations.
Random-access iterators support a superset of bidirectional iterator operations.
Contiguous iterators point to objects stored contiguously in memory.
_Category iterator_category
One of the tag types.
_Pointer pointer
This type represents a pointer-to-value_type.
_Distance difference_type
Distance between iterators is represented as this type.
_Reference reference
This type represents a reference-to-value_type.
_Tp value_type
The type "pointed to" by the iterator.