4 General utilities library [utilities]

4.2 Utility components [utility]

4.2.4 hash_­combine [hash.combine]

Insipred by Boost.ContainerHash.
Useful in the specializations of std​::​hash whose Key's salient parts consist of two or more objects.
template <class... Args> constexpr std::size_t hash_combine(const Args&... args) noexcept(see below);
Constraints:
  • and
  • std​::​hash<T> is enabled (C++ Standard's [unord.hash]) for all T in Args.
Effects: Equivalent to:
std::size_t seed{0};
return (..., (seed ^= std::hash<Args>{}(args) + (seed << 6) + (seed >> 2)));
Remarks: The expression inside noexcept is equivalent to
(noexcept(std::hash<Args>{}(args)) && ...)