Blender V5.3
blender::DefaultHash< T > Struct Template Reference

#include <BLI_hash.hh>

Public Member Functions

constexpr uint64_t operator() (const T &value) const
template<typename U>
constexpr uint64_t operator() (const U &value) const

Detailed Description

template<typename T>
struct blender::DefaultHash< T >

If there is no other specialization of DefaultHash for a given type, look for a hash function on the type itself. Implementing a hash() method on a type is often significantly easier than specializing DefaultHash. As a fallback, it also tries to use the #hash_value function which some libraries implement for their types.

To support heterogeneous lookup, a type can also implement a static hash_as(const OtherType &) function.

In the case of an enum type, the default hash is just to cast the enum value to an integer.

Definition at line 85 of file BLI_hash.hh.

Member Function Documentation

◆ operator()() [1/2]

template<typename T>
uint64_t blender::DefaultHash< T >::operator() ( const T & value) const
inlineconstexpr

Definition at line 86 of file BLI_hash.hh.

References BLI_assert_unreachable_static_t, T, and blender::v.

◆ operator()() [2/2]

template<typename T>
template<typename U>
uint64_t blender::DefaultHash< T >::operator() ( const U & value) const
inlineconstexpr

Definition at line 114 of file BLI_hash.hh.

References blender::U.


The documentation for this struct was generated from the following file: