Define STRING_ID

Define Documentation

STRING_ID(string)

Macro for string ID creation with hash computation.

On GCC/Clang: Hash is computed at compile-time (constexpr) and baked into binary. On MSVC: Hash is computed at runtime (but highly optimized/inlined) due to limitations with constexpr 128-bit multiplication in rapidhash.

The string_view points to the string literal in the binary’s read-only data section, so there’s no StringRegistry storage overhead for compile-time IDs.

Parameters:
  • string – String literal to hash (must be a compile-time constant)

Returns:

StringId with computed hash and string view to the literal