std::input_iterator_tag,std::output_iterator_tag,std::forward_iterator_tag, (3) - Linux Manuals
std::input_iterator_tag,std::output_iterator_tag,std::forward_iterator_tag,: std::input_iterator_tag,std::output_iterator_tag,std::forward_iterator_tag,
NAME
std::input_iterator_tag,std::output_iterator_tag,std::forward_iterator_tag, - std::input_iterator_tag,std::output_iterator_tag,std::forward_iterator_tag,
Synopsis
Defined in header
struct input_iterator_tag
struct output_iterator_tag
struct forward_iterator_tag : public input_iterator_tag
struct bidirectional_iterator_tag : public forward_iterator_tag
struct random_access_iterator_tag : public bidirectional_iterator_tag
{
struct contiguous_iterator_tag: public random_access_iterator_tag
};
Defines the category of an iterator. Each tag is an empty type and corresponds to
one of the
five
(until C++20)
six
(since C++20)
Iterator category tags carry information that can be used to select the most
efficient algorithms for the specific requirement set that is implied by the
category.
For every iterator type It, a typedef std::iterator_traits<It>::iterator_category is
available, which is an alias to one of these
five
(until C++20)
six
(since C++20)
Additionally, std::iterator_traits<It>::iterator_concept may be used
to indicate conformance to the iterator concepts.
There is no separate tag for LegacyContiguousIterator.
Example
Common technique for algorithm selection based on iterator category tags is to use a
dispatcher function
// Run this code
typename std::iterator_traits<Iter>::iterator_category());
Output:
See also
iterator