Template Struct hash_selector

Struct Documentation

template<typename Key, typename Enable = void>
struct hash_selector

Type trait to automatically select the hash function for a given key type.

By default, uses std::hash<Key>. Can be specialized to use a custom hash struct by defining a nested Hash type within the Key class.

Example:

class MyType {
public:
  struct Hash {
    std::size_t operator()(const MyType& x) const noexcept { ... }
  };
};

Template Parameters:
  • Key – The key type

  • Enable – SFINAE parameter for conditional selection

Public Types

using type = std::hash<Key>