Skip to content

Improve Lazy::Sequence

Compare
Choose a tag to compare
@tirimatangi tirimatangi released this 03 May 20:22
· 8 commits to main since this release
2f05c77

Lazy::Sequence now works with std::ranges::views if you use C++20 compiler.
Example:

    constexpr int N = 10;
    auto even = [](auto i) { return 0 == i % 2; };
    auto square = [](auto i) { return i * i; };
    auto lseq = Lazy::Sequence{N};

    for (auto i : lseq | std::views::filter(even) | std::views::transform(square)) {
        std::cout << i << ' ';
    }
   std::cout << "\n";

Output: 0 4 16 36 64