libzed 1.12.3
A general-purpose library for quick and simple data manipulation.
Loading...
Searching...
No Matches
range.hpp
1#pragma once
2
3#include "generator.hpp"
4#include "sentinel.hpp"
5
6namespace z {
7namespace core {
8
16generator<long, long> range(long begin, long end, long step = 1) noexcept;
17
23generator<long, long> range(long end) noexcept;
24
32generator<long, long> range(long begin, const sentinel &check, long step = 1) noexcept;
33
39template <>
40generator<long, generator<long, long>::countedState> generator<long, long>::skip(long count) noexcept;
41
42} // namespace core
43} // namespace z
An arbitrary generator for producing sequential results on-the-fly.
Definition generator.hpp:71
generator(const S &initial, std::function< const std::optional< T >(S &)> lambda)
Constructor with an initial state.
Definition generator.hpp:93
generator< T, countedState > skip(long count) noexcept
Skips a certain number of items from the generator.
Definition generator.hpp:296
long count()
Consume and discard all items from the generator, getting only the number of items generated.
Definition generator.hpp:127
A sentinel that stops a numeric generator when the value reaches a certain point.
Definition sentinel.hpp:10
Section containing core functions and classes.
generator< long, long > range(long begin, long end, long step=1) noexcept
Generate a sequence of integers in a specified range.
A specialized state for generator::enumerate().
Definition generator.hpp:80