Skip to content
/ lzy Public
forked from citybound-old/lzy

Lazy sequences and iterators for C++11

License

Notifications You must be signed in to change notification settings

mijgame/lzy

 
 

Repository files navigation

This code is part of and developed for Citybound. At some point in the future it might become stable and generally useful!

Lzy

Lazy sequences and iterators for C++11

#include <iostream>
#include <list>
#include <vector>
#include <list>

#include "lzy.h"

using namespace std;
using namespace lzy;

int main() {
    vector<int> aCoupleNumbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

    auto iteration = filter([](int i) {return i % 2 == 0;}) | map([](int i) {return i * 1.1;});

    // iterate directly over a sequence
    for (auto d : from(aCoupleNumbers) >> iteration) {
        cout << d << endl;
    }

    // compose iterations on the fly and create a container from a sequence
    auto l = from(aCoupleNumbers) >> (iteration | take(3)) >> to<list<double>>();

    return 0;
}

License

MIT, see LICENSE.md for details.

About

Lazy sequences and iterators for C++11

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 95.6%
  • C 3.2%
  • CMake 1.2%