std::weakly_incrementable(3)
πΈ NAME πΈ
std::weakly_incrementable β std::weakly_incrementable
Okay bestie, this is the C++ Standard Libary manual page for std::weakly_incrementable, and it's giving concept requirements energy. No cap.
β¨ Synopsis β¨
Defined in header <iterator>:
template< class I >
concept weakly_incrementable =
std::movable<I> &&
requires(I i) {
typename std::iter_difference_t<I>;
requires /*is-signed-integer-like*/<std::iter_difference_t<I>>;
{ ++i } -> std::same_as<I&>; // not required to be equality-preserving
i++; // not required to be equality-preserving
};
This concept is since C++20, literally.
Where /*is-signed-integer-like*/<I> is true if and only if I is a signed-integer-like type (see below).
This concept specifies requirements on types that can be incremented with the pre- and post-increment operators, but those increment operations are not necessarily equality-preserving, and the type itself is not required to be std::equality_comparable.
For std::weakly_incrementable types, a == b does not imply that ++a == ++b. Algorithms on weakly incrementable types must be single-pass algorithms. These algorithms can be used with istreams as the source of the input data through std::istream_iterator.
π¦ See also π¦
incrementableβ specifies that the increment operation on aweakly_incrementabletype (C++20) is equality-preserving and that the type isequality_comparable(concept).
That's the whole vibe. Source/version: cppreference.com, dated 2024.06.10. Bye 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