{"id":26059645,"url":"https://github.com/mnikander/cpp_function_lifting","last_synced_at":"2026-04-27T05:04:43.308Z","repository":{"id":244361722,"uuid":"814973970","full_name":"mnikander/cpp_function_lifting","owner":"mnikander","description":"Function lifting to automatically extend unary and binary functions to vector-valued inputs","archived":false,"fork":false,"pushed_at":"2024-06-15T11:18:00.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-10T15:41:43.957Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnikander.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":"2024-06-14T04:58:55.000Z","updated_at":"2024-06-15T11:18:03.000Z","dependencies_parsed_at":"2024-11-10T15:44:17.697Z","dependency_job_id":"1a1e61a8-2b63-4f7d-b8c3-c4b5ed4a12e6","html_url":"https://github.com/mnikander/cpp_function_lifting","commit_stats":null,"previous_names":["manik7/cpp_function_lifting","mnikander/cpp_function_lifting"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnikander%2Fcpp_function_lifting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnikander%2Fcpp_function_lifting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnikander%2Fcpp_function_lifting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnikander%2Fcpp_function_lifting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnikander","download_url":"https://codeload.github.com/mnikander/cpp_function_lifting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242555319,"owners_count":20148677,"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":[],"created_at":"2025-03-08T13:26:54.803Z","updated_at":"2026-04-27T05:04:38.277Z","avatar_url":"https://github.com/mnikander.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Function lifting\n\nAllow binary functions operating on two elements, to be applied to two sequences of elements, without having to explicitly call transform and without having to implement extra overloads for each function.\n\n## Getting started\n\n1. Install dependencies\n```bash\nsudo apt get install libgtest-dev cmake g++\n```\n\n2. Clone the repo\n```bash\ngit clone #...\n```\n\n3. Build and run:\n```bash\n# out-of-source build\ncd cpp_function_lifting \u0026\u0026 mkdir out \u0026\u0026 cd out \u0026\u0026 cmake .. \u0026\u0026 cd ..\ncmake --build out/ \u0026\u0026 ./out/unit_tests\n```\n\nYou can find plenty of usage examples in the unit tests, but here are a few...\n\n## Examples for unary functions\n\n```cpp\n    // unary function\n    // Negate: scalar -\u003e scalar\n    const int a = 2;\n    const int r = fl::Negate{}(a); // -2\n```\n\n'Negate' can be lifted automatically:\n\n```cpp\n    // Negate: vector -\u003e vector\n    const std::vector\u003cint\u003e a = {-1, 0, 1};\n    const std::vector\u003cint\u003e r = fl::Negate{}(a); // [1, 0, -1]\n```\n\n## Examples for binary functions\n\n```cpp\n    // binary function\n    // Add: (scalar, scalar) -\u003e scalar\n    const int a = 2;\n    const int b = 3;\n    const int r = fl::Add{}(a, b); // 5\n```\n\n'Add' can be lifted automatically:\n\n```cpp\n    // Add: (scalar, vector) -\u003e vector\n    const int a              = 10;\n    const std::vector\u003cint\u003e b = {1, 2};\n    const std::vector\u003cint\u003e r = fl::Add{}(a, b); // [11, 12]\n```\n\n```cpp\n    // Add: (scalar, vector) -\u003e vector\n    const std::vector\u003cint\u003e a = {1, 2};\n    const int b              = 10;\n    const std::vector\u003cint\u003e r = fl::Add{}(a, b); // [11, 12]\n```\n\n```cpp\n    // Add: (vector, vector) -\u003e vector\n    const std::vector\u003cint\u003e a = {10, 20};\n    const std::vector\u003cint\u003e b = {1, 2};\n    const std::vector\u003cint\u003e r = fl::Add{}(a, b); // [11, 22]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnikander%2Fcpp_function_lifting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnikander%2Fcpp_function_lifting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnikander%2Fcpp_function_lifting/lists"}