Template Class Range¶
Defined in File range.hpp
Class Documentation¶
-
template<typename
T
>
classripple
::
Range
¶ The Range class defines a utility class which allows a simpler syntax for looping a python like range based for loop.
It is wrapped range by the
range()
function, and the inteded usage is:// i = [0 ... 100) for (auto i : range(100)) { // Use i } // i = [34 .. 70) for (auto i : range(34, 70)) { // Use i } // i = [23 .. 69) step = 3 for (auto i : range(23, 69, 3)) { // Use i }
The type of the range elements are defined by the type passed to the range creation function (i.e pass a float to get a range of floats):
for (auto i : range(0.1f, 0.6f, 0.1f)) { // Use i }
- Template Parameters
T
: The type of the range data.
Public Types
-
using
ConstIterator
= IteratorImpl<true>¶ Defines the type of a constant iterator.
-
using
Iterator
= IteratorImpl<false>¶ Defines the type of a non-constant iterator.
Public Functions
-
constexpr
Range
(Value min, Value max, Value step) noexcept¶ Creates the range.
- Parameters
min
: The minimum (start) value for the range.max
: The maximum (end) value for the range.step
: The step size for the range.
-
constexpr auto
begin
() noexcept -> Iterator¶ Gets a non constant iterator to the beginning of the range.
-
constexpr auto
begin
() const -> ConstIterator¶ Gets a constant iterator to the beginning of the range.
-
constexpr auto
end
() const -> ConstIterator¶ Gets a non constant iterator to the end of the range.