libzed 1.9.9
A general-purpose library for quick and simple data manipulation.
 
Loading...
Searching...
No Matches
sentinel.hpp
1#pragma once
2#include <functional>
3
4namespace z {
5namespace core {
6
10class sentinel {
11 std::function<bool(long, long)> lambda;
12
13public:
14 sentinel() = delete;
15
20 sentinel(std::function<bool(long, long)> lambda) : lambda(lambda) {}
21
28 bool operator()(long value, long step) const noexcept {
29 return lambda(value, step);
30 };
31};
32
37extern const sentinel infinity;
38
39} // namespace core
40} // namespace z
A wrapper for std::vector.
Definition array.hpp:72
A sentinel that stops a numeric generator when the value reaches a certain point.
Definition sentinel.hpp:10
sentinel(std::function< bool(long, long)> lambda)
Constructor.
Definition sentinel.hpp:20
bool operator()(long value, long step) const noexcept
Check if the generator should stop.
Definition sentinel.hpp:28
const sentinel infinity
A sentinel that tells numeric generators to run forever.