Skip to content

Naive CXX17 generator implementation with std::thread<>

License

Notifications You must be signed in to change notification settings

488n235e/cxx-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CXX Generator

Naive CXX17 generator implementation with std::thread<>

Usage

#include <iostream>
#include "generator.hpp"

int main() {
  generator::Generate<int, int, int>
      s([](gen::Ctx<int, int> &_) -> int {
    const auto a = _.yield(0);
    const auto b = _.yield(a);
    const auto c = _.yield(b);
    const auto d = _.yield(c);
    return d;
  });
  int i = 1;
  while (!s.done()) {
    std::cout << s.resume(i++) << std::endl;
  }
}

Yields 0 2 3 4 5

About

Naive CXX17 generator implementation with std::thread<>

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages