{"id":19329896,"url":"https://github.com/zhongruoyu/metasort","last_synced_at":"2025-07-21T03:33:40.248Z","repository":{"id":153369497,"uuid":"530085018","full_name":"ZhongRuoyu/metasort","owner":"ZhongRuoyu","description":"Compile-time sorting implementations with C++ template metaprogramming.","archived":false,"fork":false,"pushed_at":"2022-08-29T13:25:53.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T06:46:51.952Z","etag":null,"topics":["cpp","metaprogramming","sorting","template-metaprogramming"],"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/ZhongRuoyu.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":"2022-08-29T05:57:32.000Z","updated_at":"2022-08-29T06:01:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"0c91239d-bbbe-45ad-9e5d-64834df99430","html_url":"https://github.com/ZhongRuoyu/metasort","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ZhongRuoyu/metasort","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongRuoyu%2Fmetasort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongRuoyu%2Fmetasort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongRuoyu%2Fmetasort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongRuoyu%2Fmetasort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZhongRuoyu","download_url":"https://codeload.github.com/ZhongRuoyu/metasort/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongRuoyu%2Fmetasort/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266235482,"owners_count":23897181,"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","metaprogramming","sorting","template-metaprogramming"],"created_at":"2024-11-10T02:31:49.157Z","updated_at":"2025-07-21T03:33:40.229Z","avatar_url":"https://github.com/ZhongRuoyu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# metasort\n\nThis is a collection of *compile-time* sorting implementations with C++\n[template metaprogramming](https://en.wikipedia.org/wiki/Template_metaprogramming).\n\nCurrently, the following sorting algorithms are implemented:\n\n- [Quicksort](https://en.wikipedia.org/wiki/Quicksort)\n- [Mergesort](https://en.wikipedia.org/wiki/Merge_sort)\n\nAll the implementation details can be found in [`metasort.h`](metasort.h).\n\n## Examples\n\nThe metasort algorithms work on an integer sequence template,\nnamed `metasort::sequence`. Its use is analogous to\n[`std::integer_sequence`](https://en.cppreference.com/w/cpp/utility/integer_sequence).\n\nThe following illustrates how sorting can be performed on a sequence.\n\n```c++\nusing seq_original = metasort::sequence\u003cint, 5, 7, 4, 2, 8, 6, 1, 9, 0, 3\u003e;\nusing seq_quicksort = metasort::quicksort::sort_t\u003cseq_original\u003e;\n```\n\nIn this example, we create a sequence of `int`s, and perform quicksort on the\nsequence. The results are computed and stored into `seq_quicksort` during\ncompilation. To verify that this works:\n\n```c++\nstatic_assert(\n        std::is_same_v\u003cseq_quicksort,\n                       metasort::sequence\u003cint, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\u003e\u003e,\n        \"quicksort assertion failed\");\n```\n\nIf the result `seq_quicksort` is not sorted, the `static_assert` assertion\nwould have failed during compilation.\n\nThe `metasort::sequence` type also comes with several helper templates. For\ninstance, the `metasort::get` template gets the value at a specified index. The\ntype also provides a `to_array()` member function, which turns the sequence\ninto an `std::array` for ease of further manipulation.\n\nSee [example.cc](example.cc) for a full example.\n\n## License\n\nCopyright (c) 2022 Zhong Ruoyu. Licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhongruoyu%2Fmetasort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhongruoyu%2Fmetasort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhongruoyu%2Fmetasort/lists"}