FreeBSD Manual Pages
std::forward_iterator(3) C++ Standard Libary std::forward_iterator(3) NAME std::forward_iterator - std::forward_iterator Synopsis Defined in header <iterator> template< class I > concept forward_iterator = std::input_iterator<I> && std::derived_from</*ITER_CONCEPT*/<I>, (since C++20) std::forward_iterator_tag> && std::incrementable<I> && std::sentinel_for<I, I>; This concept refines std::input_iterator by requiring that I also model std::incrementable (thereby making it suitable for multi-pass algo- rithms), and guaranteeing that two iterators to the same range can be compared against each other. Notes Unlike the LegacyForwardIterator requirements, the forward_iterator concept does not require dereference to return a reference. Example A minimum forward iterator. #include <cstddef> #include <iterator> struct SimpleForwardIterator { using difference_type = std::ptrdiff_t; using value_type = int; int operator*() const; SimpleForwardIterator& operator++(); SimpleForwardIterator operator++(int) { auto tmp = *this; ++*this; return tmp; } bool operator==(const SimpleForwardIterator&) const; }; static_assert(std::forward_iterator<SimpleForwardIterator>); See also specifies that a type is an input iterator, that is, its input_iterator referenced values can be read and it can be both pre- and (C++20) post-incremented (concept) bidirectional_iterator specifies that a forward_iterator is a bidi- rectional (C++20) iterator, supporting movement backwards (concept) http://cppreference.com 2024.06.10 std::forward_iterator(3)
NAME | Synopsis | Notes | Example | See also
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::forward_iterator&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>
