51 RangeCreator(T from, T to, T step) : from{from}, to{to}, step{step}, cur{from} {
55 return this->step > 0 ? this->cur < this->
to : this->cur >= this->
to;
60 return payload_type::withoutValue();
63 this->cur += this->
step;
64 return payload_type::withValue(value);
77 template <
class T =
int,
class = META::enable_if_t<META::is_arithmetic<T>()>>
81 make::ptr<details::RangeCreator<T>>(
from,
to,
step)
92 template <
class T =
int,
class = META::enable_if_t<META::is_arithmetic<T>()>>
94 return range<T>(0,
to,
step);
104 template <
class T =
int,
class = META::enable_if_t<META::is_arithmetic<T>()>>
117 META::is_arithmetic<T>()
118 && std::numeric_limits<T>::has_infinity
121 return range<T>(
from, std::numeric_limits<T>::infinity(),
step);
payload_type next() override
Retrieve the next iterator payload.
Stream< T > range(T from, T to, T step=1)
Create an scl::stream::Stream for a specified range.
StreamIteratorPayload< T > payload_type
Type alias for the payload used.
typename payload_type::value_type value_type
Type alias for the data type manipulated.
RangeCreator(T from, T to, T step)
Construct from initial, last and increment.
Global namespace of the SCL.
bool hasNext() const override
Determines whether or not this iterator can produce another value payload.
T step
the individual increment
Stream< T > infiniteRange(T from=0, T step=1)
Generate a range from the given value to +inf.
Creator for a numeric range.
Stream< T > rangeFrom(T from, T step=-1)
Generate a range from the given value to 0.
Stream< T > rangeTo(T to, T step=1)
Range from 0 to the specified value.
A class for iterators that start a stream chain.
Copyable concept, a type is copyable if it is both copy constructible and copy assignable.
typename iterator_type::payload_type payload_type
typename iterator_type::value_type value_type
#define static_require(cpt)
Class representing a stream of data.