Compile-time half-open interval of hana::integral_constants.
A range represents a half-open interval of the form [from, to) containing hana::integral_constants of a given type. The [from, to) notation represents the values starting at from (inclusively) up to but excluding from. In other words, it is a bit like the list from, from+1, ..., to-1.
In particular, note that the bounds of the range can be any hana::integral_constants (negative numbers are allowed) and the range does not have to start at zero. The only requirement is that from <= to.
hana::range is implementation defined. In particular, one should not take for granted the number and types of template parameters. The proper way to create a hana::range is to use hana::range_c or hana::make_range.ComparableFoldablerange is equivalent to folding a list of the integral_constants in the interval it spans. Iterablerange is equivalent to iterating over a list of the values it spans. In other words, iterating over the range [from, to) is equivalent to iterating over a list containing from, from+1, from+2, ..., to-1. Also note that operator[] can be used in place of the at function. Searchablerange is equivalent to searching a list of the values in the range [from, to), but it is much more compile-time efficient. Synopsis of associated functions | |
| template<> | |
| constexpr auto | make< range_tag > |
Create a hana::range representing a half-open interval of integral_constants. More... | |
| constexpr auto | make_range = make<range_tag> |
Alias to make<range_tag>; provided for convenience. More... | |
| template<typename T , T from, T to> | |
| constexpr auto | range_c = make_range(integral_c<T, from>, integral_c<T, to>) |
Shorthand to create a hana::range with the given bounds. More... | |
Friends | |
| template<typename X , typename Y > | |
| constexpr auto | operator== (X &&x, Y &&y) |
Equivalent to hana::equal | |
| template<typename X , typename Y > | |
| constexpr auto | operator!= (X &&x, Y &&y) |
Equivalent to hana::not_equal | |
Public Member Functions | |
| template<typename N > | |
| decltype(auto) constexpr | operator[] (N &&n) |
Equivalent to hana::at | |
Create a hana::range representing a half-open interval of integral_constants.
Given two IntegralConstants from and to, make<range_tag> returns a hana::range representing the half-open interval of integral_constants [from, to). from and to must form a valid interval, which means that from <= to must be true. Otherwise, a compilation error is triggered. Also note that if from and to are IntegralConstants with different underlying integral types, the created range contains integral_constants whose underlying type is their common type.
Alias to make<range_tag>; provided for convenience.
|
related |
Shorthand to create a hana::range with the given bounds.
This shorthand is provided for convenience only and it is equivalent to make_range. Specifically, range_c<T, from, to> is such that
| T | The underlying integral type of the integral_constants in the created range. |
| from | The inclusive lower bound of the created range. |
| to | The exclusive upper bound of the created range. |