{"id":15047799,"url":"https://github.com/cihansari/flexinvokable","last_synced_at":"2026-03-17T16:39:39.210Z","repository":{"id":46160242,"uuid":"129372022","full_name":"CihanSari/flexInvokable","owner":"CihanSari","description":"Single header container for lambdas with (or without) move-only encapsulation that can be invoked only once.","archived":false,"fork":false,"pushed_at":"2021-11-10T08:52:12.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T23:13:41.462Z","etag":null,"topics":["cpp","cpp17","cpp1z"],"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/CihanSari.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}},"created_at":"2018-04-13T08:22:10.000Z","updated_at":"2024-03-03T22:22:20.000Z","dependencies_parsed_at":"2022-09-03T20:03:08.644Z","dependency_job_id":null,"html_url":"https://github.com/CihanSari/flexInvokable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CihanSari%2FflexInvokable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CihanSari%2FflexInvokable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CihanSari%2FflexInvokable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CihanSari%2FflexInvokable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CihanSari","download_url":"https://codeload.github.com/CihanSari/flexInvokable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243495495,"owners_count":20299923,"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":["cpp","cpp17","cpp1z"],"created_at":"2024-09-24T21:04:50.279Z","updated_at":"2025-12-30T16:31:35.942Z","avatar_url":"https://github.com/CihanSari.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flexible invokable for C++17\n\nSingle header container for lambdas with (or without) move-only encapsulation that can be invoked only once.\n\nThe topic of this repository is to address the need to store lambdas in containers (such as vectors). The generic way you are expected to do this is in [std::function](https://en.cppreference.com/w/cpp/utility/functional/function). However, `std::function` requires the encapsulated contents to be copy constructable. This is easy to imagine from the above struct: encapsulations sometimes cause issue! If you have members that are not copiable, then you cannot use `std::function` even though contents are movable. This is the need we are trying to address in `flexInvokable`. You can store your lambdas in move-only containers.\n\n[![vah_CI](https://github.com/CihanSari/flexInvokable/actions/workflows/main.yml/badge.svg)](https://github.com/CihanSari/flexInvokable/actions/workflows/main.yml)\n[![CodeQL](https://github.com/CihanSari/flexInvokable/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/CihanSari/flexInvokable/actions/workflows/codeql-analysis.yml)\n\n## Example\nExample is shown in `test/src/example.cpp`.\n\n## How to use\nAdd flexInvokable/include/flexInvokable.hpp to your project.\n\n\n## Source\nOriginally found as an answer to the request in [stackoverflow](https://stackoverflow.com/questions/25421346/how-to-create-an-stdfunction-from-a-move-capturing-lambda-expression). \n\nI had to make slight changes from [source demo](http://coliru.stacked-crooked.com/a/1cfdcd0491686fe1) \n```\nvoid(*invoke)(void*, Args...) = nullptr; \n```\nto\n```\nR(*invoke)(void*, Args...) = nullptr; \n```\nMoreover, \n```\nstd::result_of_t\u003cstd::decay_t\u003cF\u003e\u0026(Args...)\u003e\n```\nis getting deprecated, and therefore replaced to\n```\n#if _HAS_CXX17\n    std::invoke_result_t\u003cF, Args...\u003e\n#else\n    std::result_of_t\u003cstd::decay_t\u003cF\u003e\u0026(Args...)\u003e\n#endif\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcihansari%2Fflexinvokable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcihansari%2Fflexinvokable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcihansari%2Fflexinvokable/lists"}