Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thelartians/generator

A generator class emulating coroutines' yield functionality through std::thread
https://github.com/thelartians/generator

coroutines cplusplus cpp generator python range yield

Last synced: 3 days ago
JSON representation

A generator class emulating coroutines' yield functionality through std::thread

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.com/TheLartians/Generator.svg?branch=master)](https://travis-ci.com/TheLartians/Generator)

# lars::Generator

A generator class emulating yield functionality through `std::thread` for simple iterator creation.

# Example

The code below shows how to create a python-style range iterator.

```cpp
#include
#include

lars::Generator range(int max){
return lars::Generator([=](lars::Yield &yield){
for(int i = 0;i