Hashing a string during compile time.
Compatible (tested) with Visual Studio 2017's std::hash. Can be used also cross-platform, but it's not guaranteed to be compatible with std::hash as each implementation can vary.
string value = "some string";
switch (cx_hash(value.c_str())) { // runtime hashing
case cx_hash("a"): // compile time hashing
cout << "a found!\n";
break;
.
.
.
case cx_hash("some string"): // compile time hashing
cout << "some string hash found!\n";
break;
}
some string hash found!