frozen

Header-only constexpr perfect hash generator for C++14, gperf alternative.

brewmacoslinux
Try with needOr install directly
Source

About

Header-only, constexpr alternative to gperf for C++14 users

Examples

generate perfect hash function from keyword list$ frozen::make_perfect_hash({"apple", "banana", "cherry"})
create compile-time string lookup table$ constexpr auto keywords = frozen::make_perfect_hash({"int", "float", "double"});
build fast constant-time enum from strings$ constexpr auto map = frozen::make_perfect_hash({{"red", 0}, {"green", 1}, {"blue", 2}});
optimize keyword recognition in parser$ #include <frozen/unordered_map.h> constexpr frozen::unordered_map<frozen::string, int, 5> keywords = {{"if", 1}, {"else", 2}};
eliminate runtime hash table initialization overhead$ constexpr auto cmds = frozen::make_perfect_hash({"start", "stop", "restart", "status"});