std::experimental::ranges::iterator_category - cppreference.com (original) (raw)
| Defined in header <experimental/ranges/iterator> | | | | ----------------------------------------------------------------------------------------------------------------------------------------------- | --- | | | template< class I > struct iterator_category {}; | (1) | | | template< class T > struct iterator_category<T*>; | (2) | | | template< class T > struct iterator_category<const T> : iterator_category<T> {}; | (3) | | | template< class T > requires requires { typename T::iterator_category; } struct iterator_category<T>; | (4) | |
Computes the iterator category of the class I, if any. Users may specialize iterator_category for a program-defined type.
Primary template is an empty struct.
Specialization for pointers. If
Tis an object type, provides a member typetypeequal to ranges::random_access_iterator_tag. Otherwise, there is no membertype.Specialization for const-qualified types.
Specialization for types that define a public and accessible member type
iterator_category. IfT::iterator_categoryis the same as or derived from one of iterator category tags in namespacestd, it is mapped to the corresponding tag in the namespacerangesas described below. Otherwise, provides a member typetypeequal toT::iterator_category.
- If
T::iterator_categoryis the same as or derives from std::random_access_iterator_tag, provides a member typetypeequal to ranges::random_access_iterator_tag. - Otherwise, if
T::iterator_categoryis the same as or derives from std::bidirectional_iterator_tag, provides a member typetypeequal to ranges::bidirectional_iterator_tag. - Otherwise, if
T::iterator_categoryis the same as or derives from std::forward_iterator_tag, provides a member typetypeequal to ranges::forward_iterator_tag. - Otherwise, if
T::iterator_categoryis the same as or derives from std::input_iterator_tag, provides a member typetypeequal to ranges::input_iterator_tag. - Otherwise, if
T::iterator_categoryis the same as or derives from std::output_iterator_tag, there is no membertype.
[edit] Helper alias template
| template< class T > using iterator_category_t = typename ranges::iterator_category<T>::type; | | (ranges TS) | | -------------------------------------------------------------------------------------------------- | | ----------- |