Namespaces
Variants
Views
Actions

std::input_or_output_iterator

From cppreference.com
< cpp‎ | iterator
Revision as of 04:55, 21 June 2020 by Fruderica (Talk | contribs)

 
 
Iterator library
Iterator concepts
input_or_output_iterator
(C++20)

Iterator primitives
Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(C++20)
(C++20)
(C++20)
Utilities
(C++20)
Iterator adaptors
Range access
(C++11)(C++14)
(C++14)(C++14)  
(C++11)(C++14)
(C++14)(C++14)  
(C++17)(C++20)
(C++17)
(C++17)
 
Defined in header <iterator>
template <class I>

concept input_or_output_iterator =
  requires(I i) {
    { *i } -> /*dereferenceable*/;
  } &&

  std::weakly_incrementable<I>;
(since C++20)

The input_or_output_iterator concept forms the basis of the iterator concept taxonomy; every iterator type satisfies the input_or_output_iterator requirements.

The exposition-only concept dereferenceable is satisfied if and only if the expression *std::declval<T&>() is valid and has a referenceable type (in particular, not void).

Equality preservation

Expressions declared in requires expressions of the standard library concepts are required to be equality-preserving (except where stated otherwise).

Notes

input_or_output_iterator itself only specifies operations for dereferencing and incrementing an iterator. Most algorithms will require additional operations, for example:

Unlike the LegacyIterator requirements, the input_or_output_iterator concept does not require copyability.