cpp/ranges/iota view

@1@ A range factory that generates a sequence of elements by repeatedly incrementing an initial value. Can be either bounded or unbounded (infinite). @2@ and  are expression-equivalent to  and  respectively for any suitable subexpressions  and.

Data members
Typical implementation of holds two non-static data members: the beginning value  of type  and the sentinel value  of type. The names shown here are exposition-only.

Member functions
{{member|{{small|std::ranges::iota_view::}}iota_view|2= {{dcl begin}} {{dcl|num=1|since=c++20|1= iota_view requires std::default_initializable = default; }} {{dcl|num=2|since=c++20| constexpr explicit iota_view( W value ); }} {{dcl|num=3|since=c++20| constexpr explicit iota_view( std::type_identity_t value,                             std::type_identity_t bound ); }} {{dcl|num=4|since=c++20| constexpr explicit iota_view( /* iterator */ first, /* see below */ last ); }} {{dcl end}}

@1@ Value-initializes {{c|value_}} and {{c|bound_}} via their default member initializers ({{c|1== W}} and {{c|1== Bound}}).

@2@ Initializes {{c|value_}} with {{c|value}} and value-initializes {{c|bound_}}. This constructor is used to create unbounded {{tt|iota_view}}s, e.g. {{c|iota(0)}} yields numbers 0,1,2..., infinitely.

@3@ Initializes {{c|value_}} with {{c|value}} and {{c|bound_}} with {{c|bound}}. The behavior is undefined if {{c|std::totally_ordered_with}} is modeled and {{c|1=bool(value <= bound)}} is {{c|false}}. This constructor is used to create bounded iota views, e.g. {{c|iota(10, 20)}} yields numbers from 10 to 19.

@4@ Same as {{v|3}}, except that {{c|value_}} is initialized with the {{tt|W}} value stored in {{c|first}}, and In any case, the type of {{c|last}} is same as {{c|decltype(end)}}.
 * if {{tt|W}} and {{tt|Bound}} are the same type, then the type of {{c|last}} is {{c|/* iterator */}} and {{tt|bound_}} initialized with the {{tt|W}} value stored in {{c|last}},
 * otherwise, if the {{tt|iota_view}} is unbounded (i.e. {{tt|Bound}} is {{lc|std::unreachable_sentinel_t}}), then the type of {{c|last}} is {{lc|std::unreachable_sentinel_t}} and {{c|bound_}} initialized with {{lc|std::unreachable_sentinel}}.
 * otherwise, the type of {{c|last}} is {{c|/* sentinel */}} and {{c|bound_}} initialized with the {{tt|Bound}} value stored in {{c|last}}.

For {{v|2}}, {{v|3}}, and {{v|4}}, the behavior is undefined if the {{tt|iota_view}} is bounded (i.e. {{tt|Bound}} is not {{lc|std::unreachable_sentinel_t}}) and {{c|bound_}} is initialized to a value unreachable from {{c|value_}}.

Parameters
}}

Deduction guides
For any type, is  if and only if  is integer-like, and  is  if and only if  is integer-like and capable of representing negative values.

Note that the guide protects itself against signed/unsigned mismatch bugs, like, where is a (signed)  and  is an (unsigned) std.

Helper templates
This specialization of makes  satisfy.