Note the template trick in the constructor. This forces the PrehashedString to only accept compile time string literals. The reason for this is that the PrehashedString class does not own the const char* ptr and therefore we may only use it with string literals created at compile time:
// This compiles auto prehashed_string = PrehashedString{"my_string"}; // This does not compile// The prehashed_string object would be broken if the str is modified auto str = std::string{"my_string"}; auto prehashed_string = PrehashedString{str.c_str()}; // This does not compile. // The prehashed_string object would be broken if the strptr is deleted auto* strptr = new char[5]; auto prehashed_string ...