{"id":16608419,"url":"https://github.com/curve/lambda","last_synced_at":"2025-10-09T03:07:40.321Z","repository":{"id":171104813,"uuid":"647447707","full_name":"Curve/lambda","owner":"Curve","description":"🔧 A C++ utility for working with C-Libraries","archived":false,"fork":false,"pushed_at":"2023-06-12T18:57:21.000Z","size":44,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T03:03:20.048Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Curve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-05-30T20:02:59.000Z","updated_at":"2025-05-25T13:17:48.000Z","dependencies_parsed_at":"2024-04-26T11:15:25.071Z","dependency_job_id":null,"html_url":"https://github.com/Curve/lambda","commit_stats":null,"previous_names":["curve/lambda_ptr"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Curve/lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Flambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Flambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Flambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Flambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Curve","download_url":"https://codeload.github.com/Curve/lambda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Flambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000775,"owners_count":26082911,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-12T01:26:08.222Z","updated_at":"2025-10-09T03:07:40.304Z","avatar_url":"https://github.com/Curve.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003chr\u003e\n\n\u003cdiv align=\"center\"\u003e \n    \u003cimg src=\"assets/logo.png\" height=312/\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e \n\n### lambda\n\nA utility for working with C-Libraries from C++\n\n\u003c/div\u003e\n\n---\n\n\u003cdiv align=\"center\"\u003e \n    \n### Basic Examples\n\n\u003c/div\u003e\n\n\u003e Using lambdas with capture as a function pointer\n\n```cpp\nextern \"C\" void some_c_function(void (*callback)(int a))\n{\n    // ...\n}\n\nstd::string some_string;\n\nsome_c_function(lambda::pointer_to([\u0026](int)\n{\n    some_string = \"Captured by reference!\";\n}));\n```\n\n\u003cbr/\u003e\n\n\u003e A utility for passing `void*` user data\n```cpp\nextern \"C\" void some_c_function(void (*callback)(int a, void* user_data), void* user_data)\n{\n    // ...\n}\n\nstd::string some_string;\nauto user_data = lambda::user_data(some_string);\n\nsome_c_function([](int a, void* data) {\n    auto \u0026[some_string] = decltype(user_data)::from(data).tuple();\n    some_string = \"Easy user-data!\";\n}, user_data);\n```\n\n\u003e For more examples, and some useful comments, you might want to take a look at the [tests](tests/)!\n\n---\n\n\u003cdiv align=\"center\"\u003e \n    \n### Installation\n\n\u003c/div\u003e\n\n\u003e **Note**  \n\u003e This library requires a C++20 capable compiler.\n\n- FetchContent\n\n    ```cmake\n    include(FetchContent)\n    FetchContent_Declare(lambda GIT_REPOSITORY \"https://github.com/Curve/lambda\")\n\n    FetchContent_MakeAvailable(lambda)\n    target_link_libraries(\u003cYourLibrary\u003e lambda::ptr)\n    ```\n\n- Git Submodule\n\n    ```bash\n    git submodule add \"https://github.com/Curve/lambda\"\n    ```\n    ```cmake\n    # Somewhere in your CMakeLists.txt\n    add_subdirectory(\"\u003cpath_to_lambda\u003e\")\n    target_link_libraries(\u003cYourLibrary\u003e lambda::ptr)\n    ```\n\n---\n\n\u003cdiv align=\"center\"\u003e \n    \n### Windows\n\n\u003c/div\u003e\n\n**Q:** Does this Library work on windows?  \n**A:** Yes\n\n**Q:** Does this library work with MSVC?  \n**A:** Kind of, beware that lambda captures on MSVC are broken¹ and MSVC Versions below 19.36 are affected by a bug that causes compilation errors.\n\n\u003e¹: This bug has already been reported and will hopefully be fixed with a new MSVC update.\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth\u003e❌ Broken\u003c/th\u003e\n\u003cth\u003e✅ Working\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```cpp\nsome_c_function(lambda::pointer_to([\u0026]{/*...*/}));\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```cpp\nauto fn_ptr = lambda::pointer_to([\u0026]{/*...*/});\nsome_c_function(fn_ptr);\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\n**Q:** Are there alternatives to MSVC?  \n**A:** Yes! I'd recommend to just use clang-cl","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurve%2Flambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurve%2Flambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurve%2Flambda/lists"}