{"id":21995768,"url":"https://github.com/lb--/tuples","last_synced_at":"2025-10-09T19:32:59.675Z","repository":{"id":148328288,"uuid":"42642069","full_name":"LB--/tuples","owner":"LB--","description":"C++1z template metaprogramming library for tuples as type vectors, in the public domain","archived":false,"fork":false,"pushed_at":"2016-04-15T03:35:20.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"tuples","last_synced_at":"2025-10-09T19:31:57.717Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/LB--/tuples/releases","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LB--.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":"2015-09-17T07:37:10.000Z","updated_at":"2023-09-08T17:01:46.000Z","dependencies_parsed_at":"2023-05-19T19:45:29.454Z","dependency_job_id":null,"html_url":"https://github.com/LB--/tuples","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/LB--/tuples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2Ftuples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2Ftuples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2Ftuples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2Ftuples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LB--","download_url":"https://codeload.github.com/LB--/tuples/tar.gz/refs/heads/tuples","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2Ftuples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001964,"owners_count":26083244,"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-11-29T21:18:29.368Z","updated_at":"2025-10-09T19:32:59.627Z","avatar_url":"https://github.com/LB--.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"tuples [![travis](https://travis-ci.org/LB--/tuples.svg?branch=tuples)](https://travis-ci.org/LB--/tuples)\n======\n\nTuples are useful for acting as arrays of types in template metaprogramming, often called type vectors. This library has boilerplate code for dealing with tuples at compile-time and also some utility functions.\n\n**Some support for C++1z is required.**\n\n## Usage\n### CMake\nFrom the `cmake` directory, copy the `FindLB` directory to a place in your `CMAKE_MODULE_PATH`.\nThen, add `find_package(LB/tuples 1 EXACT REQUIRED)` to your CMake script.\nYou may need to set the CMake variable `LB/tuples_ROOT` if you installed to a nonstandard location.\nFinally, link to the `LB::tuples` imported target with `target_link_libraries()`.\n\n### C++\nNote that alongside `std::tuple` there is also [`LB::tuples::tuple`](https://github.com/LB--/tuples/blob/tuples/src/tuple.hpp) - the latter does not hold any data whereas the former does.\n`std::tuple` does not support `void` or abstract types, whereas `LB::tuples::tuple` does - the latter should be your default.\n\n#### [`tuple_template_forward`](https://github.com/LB--/tuples/blob/tuples/src/tuple_template_forward.hpp)\n##### `#include \u003cLB/tuples/tuple_template_forward.hpp\u003e`\nTakes the types stored in an `LB::tuples::tuple` or a `std::tuple` and uses them as template parameters to the given template.\nDue to limitations in the C++ language, you cannot forward types to a template that has value template arguments even if they are defaulted - instead, you should create a proxy template in that situation.\n\nFor [example](https://github.com/LB--/tuples/blob/tuples/test/tuple_template_forward.cpp), you could use it to convert between `LB::tuples::tuple` and `std::tuple`:\n```cpp\n//convert LB::tuples::tuple to std::tuple\nusing t1 = LB::tuples::tuple\u003cint, int, float\u003e;\nusing t2 = LB::tuples::tuple_template_forward_t\u003cstd::tuple, t1\u003e;\nstatic_assert(std::is_same\u003ct2, std::tuple\u003cint, int, float\u003e\u003e{}, \"t1 != t2\");\n\n//convert std::tuple to LB::tuples::tuple\nusing t3 = std::tuple\u003cfloat, int, double\u003e;\nusing t4 = LB::tuples::tuple_template_forward_t\u003cLB::tuples::tuple, t3\u003e;\nstatic_assert(std::is_same\u003ct4, LB::tuples::tuple\u003cfloat, int, double\u003e\u003e{}, \"t3 != t4\");\n```\n\n#### [`tuple_forward`](https://github.com/LB--/tuples/blob/tuples/src/tuple_forward.hpp)\n##### `#include \u003cLB/tuples/tuple_forward.hpp\u003e`\nTakes the values in a `std::tuple` and calls a function with them.\nSee [`std::apply`](http://en.cppreference.com/w/cpp/utility/apply) - `tuple_forward` is an implementation for cases when `std::apply` is not available.\nIf you have access to `std::apply` and/or `std::invoke`, please use them instead as they are more robust.\nWhen C++17 is finalized and major compilers and standard library implementations have support for `std::apply`, this function will be deprecated.\nFor obvious reasons, `LB::tuples::tuple` is not supported.\n\n[Example](https://github.com/LB--/tuples/blob/tuples/test/tuple_forward.cpp):\n```cpp\nstatic constexpr auto t1 = std::make_tuple(1, 1);\nstatic constexpr auto t2 = std::make_tuple(1, 2);\nstatic_assert(LB::tuples::tuple_forward(std::equal_to\u003cint\u003e{}, t1), \"t1 doesn't contain the same value twice\");\nstatic_assert(!LB::tuples::tuple_forward(std::equal_to\u003cint\u003e{}, t2), \"t2 contains the same value twice\");\n```\n\n#### [`tuple_type_cat`](https://github.com/LB--/tuples/blob/tuples/src/tuple_type_cat.hpp)\n##### `#include \u003cLB/tuples/tuple_type_cat.hpp\u003e`\nConcatenates the types in zero or more `LB::tuples::tuple`s in left-to-right order.\n`std::tuple` is not supported.\n\n[Example](https://github.com/LB--/tuples/blob/tuples/test/tuple_type_cat.cpp):\n```cpp\nusing t1 = LB::tuples::tuple\u003cint\u003e;\nusing t2 = LB::tuples::tuple\u003cfloat\u003e;\nusing t3 = typename LB::tuples::tuple_type_cat_t\u003ct1, t2\u003e;\nstatic_assert(std::is_same\u003ct3, LB::tuples::tuple\u003cint, float\u003e\u003e{}, \"t1 + t2 != t3\");\n```\n\n#### [`tuple_contains`](https://github.com/LB--/tuples/blob/tuples/src/tuple_contains.hpp)\n##### `#include \u003cLB/tuples/tuple_contains.hpp\u003e`\nChecks if an `LB::tuples::tuple` contains the given type.\n`std::tuple` is not supported.\n\n[Example](https://github.com/LB--/tuples/blob/tuples/test/tuple_contains.cpp):\n```cpp\nusing t1 = LB::tuples::tuple\u003cint, int\u003e;\nusing t2 = LB::tuples::tuple\u003cint, float\u003e;\nstatic_assert(!LB::tuples::tuple_contains\u003ct1, float\u003e{}, \"t1 contains float\");\nstatic_assert(LB::tuples::tuple_contains_v\u003ct2, float\u003e, \"t2 doesn't contain float\");\n```\n\n#### [`tuple_prune`](https://github.com/LB--/tuples/blob/tuples/src/tuple_prune.hpp)\n##### `#include \u003cLB/tuples/tuple_prune.hpp\u003e`\nTakes an `LB::tuples::tuple` and removes duplicate types without rearranging the order of the types.\n`std::tuple` is not supported.\n\n[Example](https://github.com/LB--/tuples/blob/tuples/test/tuple_prune.cpp):\n```cpp\nusing pruned_t = LB::tuples::tuple_prune_t\n\u003c\n\tLB::tuples::tuple\u003cvoid, void, int, void, int, short, void, short, int, short\u003e\n\u003e;\nstatic_assert(std::is_same\u003cpruned_t, LB::tuples::tuple\u003cvoid, int, short\u003e\u003e{}, \"tuple_prune is broken\");\n```\n\n#### [`multi_assert`](https://github.com/LB--/tuples/blob/tuples/src/multi_assert.hpp)\n##### `#include \u003cLB/tuples/multi_assert.hpp\u003e`\nGiven a template that takes zero or more template arguments and yields a `value` member, takes all the given `LB::tuples::tuple`s and/or `std::tuple`s and forwards their contents to the given template individually.\nThe resulting `value` is all the intermediate `value`s combined with `\u0026\u0026`.\nIn other words, asserts that multiple tuples satisfy a requirement.\n\n[Example](https://github.com/LB--/tuples/blob/tuples/test/multi_assert.cpp):\n```cpp\nusing t1 = LB::tuples::tuple\u003cint, int\u003e;\nusing t2 = LB::tuples::tuple\u003cfloat, float\u003e;\nusing t3 = LB::tuples::tuple\u003cint, float\u003e;\n\nstatic_assert(LB::tuples::multi_assert\u003cstd::is_same, t1, t2\u003e{}, \"t1 or t2 isn't homogeneous\");\nstatic_assert(!LB::tuples::multi_assert_v\u003cstd::is_same, t1, t2, t3\u003e, \"t1, t2 and t3 are homogeneous\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flb--%2Ftuples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flb--%2Ftuples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flb--%2Ftuples/lists"}