| | |
| (1) | (since C++20) |
template<class S,class I> inlineconstexprbool disable_sized_sentinel_for=false; | (2) | (since C++20) |
| | |
1) Thesized_sentinel_for concept specifies that an object of the iterator typeI and an object of the sentinel typeS can be subtracted to compute the distance between them in constant time.
2) Thedisable_sized_sentinel_for variable template can be used to prevent iterators and sentinels that can be subtracted but do not actually modelsized_sentinel_for from satisfying the concept.
A program may specialize
disable_sized_sentinel_for for cv-unqualified non-array object type
S and
I, as long as at least one of which is a
program-defined type. Such specializations are usable in
constant expressions and have type
constbool.
[edit]Semantic requirements
Leti be an iterator of typeI, ands a sentinel of typeS such that[i, s) denotes a range. Letn be the smallest number of applications of++i necessary to makebool(i== s) betrue.I andS modelsized_sentinel_for<S, I> only if all following conditions are satisfied:
[edit]Equality preservation
Expressions declared inrequires expressions of the standard library concepts are required to beequality-preserving (except where stated otherwise).
[edit]Implicit expression variations
Arequires expression that uses an expression that is non-modifying for some constant lvalue operand also requiresimplicit expression variations.
[edit]See also
| specifies that a range knows its size in constant time (concept)[edit] |
| returns an integer equal to the size of a range (customization point object)[edit] |