About this question

Compile-Time FNV-1a String Hash

Hard · template_metaprogramming · Quant Developer interview question · constexpr, compile-time, hashing, fnv1a, symbol-routing, template-metaprogramming, c++17

In high-frequency trading, message dispatch based on string identifiers like instrument symbols must be extremely fast. Using constexpr functions to hash these strings at compile time eliminates runtime lookups, enabling O(1) dispatch via switch statements. This problem uses the FNV-1a algorithm, a simple and effective choice for generating compile-time integer constants from short strings. Task Implement the constexpr function fnv1a_hash(const char str, std::size_t len) to compute the 32-bit F