Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/thelartians/generator
- Owner: TheLartians
- License: mit
- Created: 2016-08-21T10:30:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-20T15:44:07.000Z (over 5 years ago)
- Last Synced: 2024-12-27T08:03:52.402Z (11 days ago)
- Topics: coroutines, cplusplus, cpp, generator, python, range, yield
- Language: C++
- Homepage:
- Size: 29.3 KB
- Stars: 9
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
#includelars::Generator range(int max){
return lars::Generator([=](lars::Yield &yield){
for(int i = 0;i