-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
https://github.com/boostorg/container_hash/blob/develop/include/boost/container_hash/hash.hpp
Since most part of internal calculations are based on integer arithmetic and bitwise operations, I believe those three functions and all their variants can be marked constexpr today. Can someone please enlighten me, why the standard std::hash<T>::operator() and proposed std::hash_combine() in P0814R2 is not constexpr? (backward-compatibility, or other reasons?)
If we are to provide constexpr-ness, there are two cases of implementations:
- When user is using standard later or equal to C++20
- In this case, non-constexpr intrinsic like
_rotl(defined forBOOST_FUNCTIONAL_HASH_ROTL32) can be replaced withstd::rotl
- In this case, non-constexpr intrinsic like
- When user is using C++14 to C++17 and one prefers constexpr
- The library can fallback to bitwise implementation (which is always
constexpr) - Currently Boost.ContainerHash provides no option for this case. I think new macro like
BOOST_FUNCTIONAL_HASH_USE_CONSTEXPRis needed.
- The library can fallback to bitwise implementation (which is always
refs: cplusplus/papers#253
Metadata
Metadata
Assignees
Labels
No labels