`std::basic_string::operator==` adds constexpr versions in C++20. `hash_code()` returns an integer which shouldn't be a problem anyways.
Furthermore, the thing about `constexpr` is that it can be evaluated at compile-time but doesn't need to be. So it could still be used at run-time in the presence of DLLs. Or am I overlooking something?


On Sat, Dec 5, 2020 at 3:52 PM Arthur O'Dwyer <arthur.j.odwyer@gmail.com> wrote:
On Sat, Dec 5, 2020 at 9:05 AM darkdragon via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
It would be awesome if a constexpr version of hash_code() and
preferably name() would be included in the standard. Is there anything
more constexpr than type_info?

Sadly, yes; `type_info` is intimately tied up with RTTI, and many implementations implement type_info::operator== as a string-comparison of the names of the types, so that it'll keep working even in the presence of dynamically linked libraries (DLLs).

So your goal might not be literally impossible, but it won't be trivial, either.

‚ÄďArthur