std::input_iterator(3)
π
std::input_iterator(3) π
okay bestie, welcome to the std::input_iterator(3) page from the C++ Standard Libary manual β yes, that's the manual name exactly, and we're keeping it π. This is the whole thing, no cap, no skipped details.
πΈ NAME πΈ
std::input_iterator - std::input_iterator
π¦ Synopsis π¦
okay so it's Defined in header <iterator>, and it's tagged (since C++20) β¨. Here's the synopsis exactly as the page gives it, version marker and all:
Defined in header <iterator>
template< class I >
concept input_iterator =
std::input_or_output_iterator<I> &&
std::indirectly_readable<I> &&
(since C++20)
requires { typename /*ITER_CONCEPT*/<I>; } &&
std::derived_from</*ITER_CONCEPT*/<I>,
std::input_iterator_tag>;
So the input_iterator concept is a refinement of input_or_output_iterator β it adds the requirement that the referenced values can be read (via indirectly_readable) and the requirement that the iterator concept tag be present. slay π
π‘ Notes π‘
important note, bestie: Unlike theLegacyInputIteratorrequirements, theinput_iteratorconcept does not requireequality_comparable, since input iterators are typically compared with sentinels. iykyk β¨
π Example π
A minimum input iterator. iconic π
#include <cstddef>
#include <iterator>
struct SimpleInputIterator
{
using difference_type = std::ptrdiff_t;
using value_type = int;
int operator*() const;
SimpleInputIterator& operator++();
void operator++(int) { ++*this; }
};
static_assert(std::input_iterator<SimpleInputIterator>);
π See also π
input_or_output_iteratorβ specifies that objects of a type can be incremented and dereferenced (concept)(C++20)π¦forward_iteratorβ specifies that aninput_iteratoris a forward iterator, supporting equality comparison and multi-pass (concept)(C++20)π₯
cute sign-off time: this page is from http://cppreference.com, version/date 2024.06.10, and it's the std::input_iterator(3) page β mwah, bestie ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms