{"id":28200731,"url":"https://github.com/9inefold/variant","last_synced_at":"2025-07-22T22:03:01.525Z","repository":{"id":137761351,"uuid":"597316935","full_name":"9inefold/variant","owner":"9inefold","description":"Custom variant implementation for c++20","archived":false,"fork":false,"pushed_at":"2023-02-04T06:42:54.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T17:45:36.354Z","etag":null,"topics":["cpp","cpp20","template-metaprogramming","template-project"],"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/9inefold.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,"zenodo":null}},"created_at":"2023-02-04T06:41:23.000Z","updated_at":"2023-02-07T02:33:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7d7dc0d-e5b6-4e2f-8a56-442fa725fea7","html_url":"https://github.com/9inefold/variant","commit_stats":null,"previous_names":["9inefold/variant","8ightfold/variant"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/9inefold/variant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9inefold%2Fvariant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9inefold%2Fvariant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9inefold%2Fvariant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9inefold%2Fvariant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/9inefold","download_url":"https://codeload.github.com/9inefold/variant/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9inefold%2Fvariant/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266580298,"owners_count":23951193,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["cpp","cpp20","template-metaprogramming","template-project"],"created_at":"2025-05-16T21:16:34.448Z","updated_at":"2025-07-22T22:03:01.463Z","avatar_url":"https://github.com/9inefold.png","language":"C++","readme":"# variant\nThis is my own implementation of ``std::variant`` for c++20. \nInstead of using a recursive union, it uses pointers to represent the various possible states.\nIt uses multiple inheritance of a \"node\" structure to call the active overload.\n\n## Usage\n``variant`` can be used very similarly to ``std::variant``. \nHere is an example of how it can be used:\n```cpp\nvariant\u003cint, std::string\u003e v1 { \"Hello world!\" };\nv1.visit([](auto\u0026\u0026 a) { std::cout \u003c\u003c a \u003c\u003c std::endl; });\n\nv1.emplace\u003cint\u003e(1);\nstd::cout \u003c\u003c \"at int: \" \u003c\u003c v1[Tp\u003cint\u003e] \u003c\u003c std::endl;\n\nvariant v2 { std::move(v1) };\nv2.visit([](auto\u0026\u0026 a) { std::cout \u003c\u003c a \u003c\u003c std::endl; });\n\nv2.emplace\u003cstd::string\u003e(\"std::string is active!\");\nif(v2.contains\u003cstd::string\u003e()) \n    std::cout \u003c\u003c v2[Tp\u003cstd::string\u003e] \u003c\u003c std::endl;\n```\n\n## Notes\nYou cannot use multiple of the same type in the variant, \nas there are several overloads that would be ambiguous.\n\nAs always, if you have any issues, feel free to let me know!","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9inefold%2Fvariant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F9inefold%2Fvariant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9inefold%2Fvariant/lists"}