JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
jh::concepts::input_iterator Concept Reference

Concept for readable, comparable single-pass iterators. More...

#include <jh/conceptual/iterator.h>

Concept definition

template<typename I, typename S = I>
concept input_iterator =
sentinel_for<S, I> && requires(I &it) {
{ ++it } -> std::same_as<I &>;
{ it++ } -> std::convertible_to<I>;
}
Concept for types that can be read indirectly via dereference.
Definition iterator.h:327
Concept for readable, comparable single-pass iterators.
Definition iterator.h:468
Concept for detecting iterator-like types based on behavior.
Definition iterator.h:387
Concept for detecting sentinel-iterator compatibility.
Definition iterator.h:433

Detailed Description

Concept for readable, comparable single-pass iterators.

  • Refines is_iterator and indirectly_readable, ensuring the iterator supports dereference and increment operations.
  • Requires compatibility with a corresponding sentinel type (sentinel_for<S, I>).
  • Represents single-pass input traversal — readable but not necessarily multi-pass or writable.
  • When the sentinel type S differs from I, it is recommended not to use this concept alone. In such cases, it implicitly verifies whether the provided begin() and end() form a valid pair, avoiding redundant standalone sentinel_for checks.
Template Parameters
IIterator-like type providing readable sequential access.
SSentinel type marking the end of iteration (defaults to I).