{"id":15686418,"url":"https://github.com/thelartians/generator","last_synced_at":"2025-05-07T18:46:40.498Z","repository":{"id":88218156,"uuid":"66193064","full_name":"TheLartians/Generator","owner":"TheLartians","description":"A generator class emulating coroutines' yield functionality through std::thread","archived":false,"fork":false,"pushed_at":"2019-04-20T15:44:07.000Z","size":30,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T12:58:14.506Z","etag":null,"topics":["coroutines","cplusplus","cpp","generator","python","range","yield"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheLartians.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-21T10:30:06.000Z","updated_at":"2022-08-16T03:11:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"afbe666c-6a19-42e5-a8c2-e165c1aea5f7","html_url":"https://github.com/TheLartians/Generator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheLartians","download_url":"https://codeload.github.com/TheLartians/Generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252937688,"owners_count":21828420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coroutines","cplusplus","cpp","generator","python","range","yield"],"created_at":"2024-10-03T17:40:06.140Z","updated_at":"2025-05-07T18:46:40.057Z","avatar_url":"https://github.com/TheLartians.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/TheLartians/Generator.svg?branch=master)](https://travis-ci.com/TheLartians/Generator)\n\n# lars::Generator\n\nA generator class emulating yield functionality through `std::thread` for simple iterator creation.\n\n# Example\n\nThe code below shows how to create a python-style range iterator.\n\n```cpp\n#include \u003clars/generator.h\u003e\n#include \u003ciostream\u003e\n\nlars::Generator\u003cint\u003e range(int max){\n  return lars::Generator\u003cint\u003e([=](lars::Yield\u003cint\u003e \u0026yield){\n    for(int i = 0;i\u003cmax;++i) yield(i);\n  });\n}\n\nint main(){\n  for(int i:range(10)) std::cout \u003c\u003c i \u003c\u003c std::endl;\n}\n```\n\nInstallation and usage\n----------------------\nWith [CPM](https://github.com/TheLartians/CPM), lars::Generator can be added to your project by adding the following to your projects' `CMakeLists.txt`.\n\n```cmake\nCPMAddPackage(\n  NAME LarsGenerator\n  VERSION 0.1\n  GIT_REPOSITORY https://github.com/TheLartians/Generator.git\n)\n\ntarget_link_libraries(myProject LarsGenerator)\n```\n\nAlternatively, download the repository include it via `add_subdirectory`. Installing lars::Generator will make it findable in CMake's `find_package`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthelartians%2Fgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthelartians%2Fgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthelartians%2Fgenerator/lists"}