libzed 1.9.9
A general-purpose library for quick and simple data manipulation.
 
Loading...
Searching...
No Matches
chain.hpp
1#pragma once
2
3#include "../core/generator.hpp"
4
5namespace z {
6namespace util {
7
17template <typename T, typename U, typename V>
19 return core::generator<T, bool>(false, [&first, &second](bool &first_exhausted) {
20 if (!first_exhausted) {
21 auto item = first.next();
22 if (item.done) {
23 first_exhausted = true;
24 } else {
25 return item;
26 }
27 }
28
29 return second.next();
30 });
31}
32
33} // namespace util
34} // namespace z
A wrapper for std::vector.
Definition array.hpp:72
core::generator< T, bool > chain(core::generator< T, U > &first, core::generator< T, V > &second) noexcept
Chains two generators together.
Definition chain.hpp:18