{"id":46714029,"url":"https://github.com/hordi/hash","last_synced_at":"2026-03-09T10:02:05.535Z","repository":{"id":63099153,"uuid":"169001498","full_name":"hordi/hash","owner":"hordi","description":"Fast C++ flat (open addressing) hash set, map","archived":false,"fork":false,"pushed_at":"2026-01-16T23:22:22.000Z","size":2362,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-14T03:39:02.283Z","etag":null,"topics":["cpp","hash","hashing","map","set","unordered-map","unordered-set"],"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/hordi.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-03T22:35:50.000Z","updated_at":"2026-01-16T23:18:04.000Z","dependencies_parsed_at":"2023-01-25T07:46:44.220Z","dependency_job_id":null,"html_url":"https://github.com/hordi/hash","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/hordi/hash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hordi%2Fhash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hordi%2Fhash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hordi%2Fhash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hordi%2Fhash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hordi","download_url":"https://codeload.github.com/hordi/hash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hordi%2Fhash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30290921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","hash","hashing","map","set","unordered-map","unordered-set"],"created_at":"2026-03-09T10:02:03.776Z","updated_at":"2026-03-09T10:02:05.530Z","avatar_url":"https://github.com/hordi.png","language":"C++","readme":"# hash\nFast C++ flat (open addressing) hash set/map header only library. Requred C++11 (only because of \"constexpr\" and \"noexcept\" modifiers usage).\n\nDrop in replacement (mostly, references invaildated if reallocation happens, allocator-type is absent) implementation of unordered hash-set and hash-map.\nDefault hash-functions use actual 32-bits hash-value, makes sense to use if amount of elements less than UINT_MAX/2 for good distribution. In other case - should be used 64-bits result hash-function (hash_set1.hpp supports full range of size_t).\n\nhdr::hash_grow_map_heavy and hdr::hash_grow_set_heavy added for big (sizeof) objects to minimize memory usage and improve iteration speed.\n\n\nEXAMPLES\n\nSimplest set-map\n```cpp\n#include \"hash_set1.h\"\n#include \u003ciostream\u003e\n\nint main() {\n    hrd1::hash_set\u003cint\u003e ss(1024);\n    hrd1::hash_map\u003cint, int\u003e ms(1024);\n    for (int i = 0; i != 1024; ++i) {\n        ss.insert(i);\n        ms[i] = i + 10;\n    }\n\n    hrd1::hash_set\u003cint\u003e ss1(ss.begin(), ss.end());\n\n    size_t cnt = 0, cnt2 = 0, cnt3 = 0;\n    for (int i = 0; i != 1024 * 1024; ++i) {\n        cnt += ss.count(i);\n        cnt2 += ms.count(i);\n        cnt3 += ss1.count(i);\n    }\n\n    std::cout \u003c\u003c \"found: \" \u003c\u003c cnt \u003c\u003c ':' \u003c\u003c cnt2 \u003c\u003c ':' \u003c\u003c cnt3 \u003c\u003c '\\n';\n    \n    return 0;\n}\n```\n\nCustom \"complex\" type with own hash-function and equal-operator\n```cpp\n\n#include \"hash_set.h\"\n#include \u003ciostream\u003e\n\nstruct Key1 {\n    Key1(uint64_t k, uint64_t d = 0) :key(k), data(d) {}\n\n    bool operator==(const Key1\u0026 r) const noexcept {\n        return key == r.key;\n    }\n\n    uint64_t key;\n    uint64_t data;\n};\n\ntemplate\u003c\u003e\nstruct hrd::hash_base::hash_\u003cKey1\u003e {\n    size_t operator()(const Key1\u0026 r) const noexcept {\n        return hrd::hash_base::hash_1\u003c8\u003e(\u0026r.key);\n    }\n};\n\nint main() {\n    hrd::hash_set\u003cKey1\u003e ss(1024);\n    \n    for (size_t i = 0; i != 1024; ++i)\n        ss.insert(Key1(i, i + 10));\n\n    size_t cnt = 0, cnt1 = 0;\n    for (size_t i = 0; i != 1024 * 1024; ++i)\n        cnt += ss.count(Key1(i));\n\n    for (auto i = ss.begin(), e = ss.end(); i != e; ++i)\n        cnt1++;\n\n    std::cout \u003c\u003c \"found: \" \u003c\u003c cnt \u003c\u003c ':' \u003c\u003c cnt \u003c\u003c '\\n';\n\n    return 0;\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhordi%2Fhash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhordi%2Fhash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhordi%2Fhash/lists"}