|
constexpr | range_t (Value min_, Value max_, Delta step_=1) |
| 2- and 3-argument constructor. Explicitly specify start, end, and optionally the step amount. More...
|
|
constexpr | range_t (Value max_) |
| 1-argument constructor. Start is implicitly zero and step is 1 or -1, depending on the sign of max. More...
|
|
constexpr auto | begin () const noexcept -> iterator |
| Returns an iterator to the beginning of the range. More...
|
|
constexpr auto | end () const noexcept -> iterator |
| Return an iterator to the end of the range. More...
|
|
constexpr auto | size () const noexcept -> std::size_t |
| Returns the distance between start() and stop(). More...
|
|
constexpr auto | empty () const noexcept -> bool |
| Query whether the range will generate any elements. More...
|
|
template<typename Integral > |
constexpr auto | operator[] (Integral x) const noexcept -> decltype(begin()[x]) |
|
constexpr auto | lesser () const noexcept(nothrow_copyable) -> Value |
|
constexpr auto | greater () const noexcept(nothrow_copyable) -> Value |
|
template<typename Container , enable_if_t< is_linear_container_v< Container > and std::is_constructible< Container, iterator, iterator >::value > * = nullptr> |
| operator Container () const noexcept(noexcept(Container(std::declval< iterator >(), std::declval< iterator >()))) |
| Returns a linear container whose elements are this range. More...
|
|
template<typename Container , enable_if_t< is_setlike_v< Container > and std::is_constructible< Container, iterator, iterator >::value > * = nullptr> |
| operator Container () const noexcept(noexcept(Container(std::declval< iterator >(), std::declval< iterator >()))) |
| Returns a setlike container whose elements are this range. More...
|
|
template<typename Value, typename Delta>
class kblib::range_t< Value, Delta >
A range generator, similar to Python 3's range().
Generates a half-open range, [min, max).
- Template Parameters
-
Value | The type of elements in the range. Must support comparison (equality and relational) and subtraction, but does not strictly need to be numeric. Must be copyable. Must be value-initializable. Notably, RandomAccessIterators are valid Value types. |
Delta | A type used to mutate Value values. std::declval<Value>() + std::declval<Delta>() must be a valid expression and must return type Value. Delta must be implicitly constructible and assignable from, as well as comparable to, int. |
Definition at line 221 of file iterators.h.
template<typename Value , typename Delta >
template<typename Container , enable_if_t< is_linear_container_v< Container > and std::is_constructible< Container, iterator, iterator >::value > * = nullptr>
Returns a linear container whose elements are this range.
Definition at line 436 of file iterators.h.
template<typename Value , typename Delta >
template<typename Container , enable_if_t< is_setlike_v< Container > and std::is_constructible< Container, iterator, iterator >::value > * = nullptr>
Returns a setlike container whose elements are this range.
Definition at line 450 of file iterators.h.