{"id":19708781,"url":"https://github.com/willkill07/named-tuple","last_synced_at":"2025-10-06T20:54:44.979Z","repository":{"id":192112600,"uuid":"686083137","full_name":"willkill07/named-tuple","owner":"willkill07","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-01T23:18:54.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T04:13:17.038Z","etag":null,"topics":["cpp","cpp-lib","cpp-library","cpp-templates","cpp20","cpp20-lib","cpp20-library","header-only","header-only-lib","header-only-library","modern-cpp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willkill07.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-01T17:44:34.000Z","updated_at":"2024-02-21T11:14:37.000Z","dependencies_parsed_at":"2023-09-02T17:12:59.413Z","dependency_job_id":null,"html_url":"https://github.com/willkill07/named-tuple","commit_stats":null,"previous_names":["willkill07/named-tuple"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2Fnamed-tuple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2Fnamed-tuple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2Fnamed-tuple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2Fnamed-tuple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willkill07","download_url":"https://codeload.github.com/willkill07/named-tuple/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241025796,"owners_count":19896512,"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","cpp-lib","cpp-library","cpp-templates","cpp20","cpp20-lib","cpp20-library","header-only","header-only-lib","header-only-library","modern-cpp"],"created_at":"2024-11-11T21:44:56.842Z","updated_at":"2025-10-06T20:54:39.945Z","avatar_url":"https://github.com/willkill07.png","language":"C++","readme":"# named-tuple\nSingle header implementation a named-tuple in C++\n\nTuples have always been addressible via index and type -- the obvious gap here is accessing by name. This (small) header-only library provides just that!\n\n### Usage\n\n```cpp\nauto make_config() {\n    using Configuration = named_tuple\u003c\n      named_val\u003cstd::string, \"install-path\"\u003e,\n      named_val\u003cstd::string, \"build-path\"\u003e,\n      named_val\u003cint, \"retry-limit\"\u003e,\n      named_val\u003cbool, \"system-wide\"\u003e\n    \u003e;\n\n    Configuration default_config{\"/usr/local/\", \"./build\", 1, true};\n    return default_config;\n}\n\nvoid use_config(auto\u0026\u0026 config) {\n    // named_get supports multiple values and will construct an intermediate named_tuple\n    auto build_options = named_get\u003c\"build-path\", \"retry-limit\"\u003e;\n    auto install_options = named_get\u003c\"install-path\", \"system-wide\"\u003e;\n}\n```\n\n### Components\n\n- `named_tuple`: The tuple class - `sizeof(named_tuple) == sizeof(tuple)`\n- `named_val`: descriptor used to indicate the type and name\n- `named_get\u003c\"name\"\u003e`: accessor for retrieving a value stored in the `named_tuple`\n- `named_get\u003cnames...\u003e`: accessor for splicing a `named_tuple`. You can even permute!\n- `named_tie\u003cnames...\u003e`: std::tie() equivalent for `named_tuple`\n\n### Limitations\n\n* Deduction guides are not really feasible due to their limitation of needing all template arguments specified.\n* I have not extensively tested the reference semantics and behavior. I welcome contributions to this library.\n\n### Compiler support\n\nRequires a small subset of C++20 features.\n\nTested on:\n\n- Linux\n  * g++ 13.0\n  * clang 16.0\n- macOS\n  * g++ 13.0\n  * clang 16.0\n  * AppleClang 14.0\n\n----------\n\n[![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png)](\"http://creativecommons.org/publicdomain/zero/1.0/\")\n\nTo the extent possible under law, [Will Killian](https://github.com/willkill07) has waived all copyright and related or neighboring rights to the `expected` library. This work is published from: the United States of America.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillkill07%2Fnamed-tuple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillkill07%2Fnamed-tuple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillkill07%2Fnamed-tuple/lists"}