{"id":18898338,"url":"https://github.com/brainstone/staticmap","last_synced_at":"2025-07-12T02:34:11.144Z","repository":{"id":204225862,"uuid":"711361191","full_name":"BrainStone/StaticMap","owner":"BrainStone","description":"A compile time static map for C++20 or above","archived":false,"fork":false,"pushed_at":"2023-11-08T23:46:59.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T19:25:48.628Z","etag":null,"topics":["constexpr","constexpr-all-the-things","cpp-library","cpp20","cpp23","header-only","library","map","modern-cpp","storage","string"],"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/BrainStone.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}},"created_at":"2023-10-29T02:33:27.000Z","updated_at":"2024-11-18T03:08:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"f49a1a73-3977-4044-8123-d8fda45626d2","html_url":"https://github.com/BrainStone/StaticMap","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"ea79fddfcd90fe1a1e61115a755307d3d184fae8"},"previous_names":["brainstone/staticstringmap","brainstone/staticmap"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/BrainStone/StaticMap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrainStone%2FStaticMap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrainStone%2FStaticMap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrainStone%2FStaticMap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrainStone%2FStaticMap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrainStone","download_url":"https://codeload.github.com/BrainStone/StaticMap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrainStone%2FStaticMap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264925746,"owners_count":23684193,"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":["constexpr","constexpr-all-the-things","cpp-library","cpp20","cpp23","header-only","library","map","modern-cpp","storage","string"],"created_at":"2024-11-08T08:42:02.810Z","updated_at":"2025-07-12T02:34:11.082Z","avatar_url":"https://github.com/BrainStone.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StaticMap\n\nA compile time static map for C++20 or above.\n\nThis nifty little library offers the class `static_map` and the convenient alias `static_string_map`, which is a class\nthat can store a key value mapping at compile time, including retrieving the values at compile time. The strings in\nquestion for `static_string_map` are `std::string_view` strings for maximum efficiency.\n\n## Usage Example\n\n```cpp\n#include \"static_string_map.hpp\"\n\nconstexpr static_map messages = make_static_string_map({{\"hi\", \"hi\"}, {\"foo\", \"bar\"}});\nconstexpr std::string_view constexpr_message = messages[\"foo\"]; // Initialized to \"bar\"\nconstexpr std::string_view constexpr_message = messages[\"xxx\"]; // Compile error\n\nint main() {\n    std::string dynamic_message;\n    std::cin \u003e\u003e dynamic_message\n    \n    std::cout \u003c\u003c messages[dynamic_message] \u003c\u003c std::endl; // Will either print the corresponding message or throw an exception\n}\n```\n\n## Using this lib\n\nThis is a CMake library, and you can use it as you would any other CMake library. See Instructions further down on how\nto use it without CMake too.\n\n### CMake\n\nYou can use the `FetchContent` module to let CMake download the lib for you:\n\n```cmake\n# Download stomfoolery\ninclude(FetchContent)\nFetchContent_Declare(\n        static_map\n        GIT_REPOSITORY https://github.com/BrainStone/StaticMap.git\n        GIT_TAG v2.0.0\n)\n\nFetchContent_MakeAvailable(static_map)\n\n# Use static_map\nproject(${PROJECT_NAME} CXX)\ntarget_link_libraries(${PROJECT_NAME} PRIVATE static_map)\n```\n\n### Without CMake\n\nEssentially you have two options:\n\n- Add `$static_map_base_path/src` to your include paths.\n- Copy `src/static{,_string}_map.hpp` into an already in use include path.\n\n## Building\n\nFirst of all there's no actual library to build. The only thing that can be build and executed are the test.  \nNow this is a CMake project, so just follow standard build procedure:\n\n```bash\n# Build\ncmake -B build\ncmake --build build\n\n# Run tests\ncd build\nctest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainstone%2Fstaticmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrainstone%2Fstaticmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainstone%2Fstaticmap/lists"}