Loading...
Searching...
No Matches
hash.h File Reference
+ Include dependency graph for hash.h:

Go to the source code of this file.

Classes

struct  TfCStrHashWrapper
 A structure that wraps a char pointer, indicating intent that it should be hashed as a c-style null terminated string. More...
 
class  TfHash
 A user-extensible hashing mechanism for use with runtime hash tables. More...
 
struct  TfHashCharPtr
 A hash function object that hashes the address of a char pointer. More...
 
struct  TfHashCString
 A hash function object that hashes null-terminated c-string content. More...
 
struct  TfEqualCString
 A function object that compares two c-strings for equality. More...
 

Functions

template<class HashState , class T >
std::enable_if_t< std::is_integral< T >::value > TfHashAppend (HashState &h, T integral)
 
template<class HashState , class Enum >
std::enable_if_t< std::is_enum< Enum >::value > TfHashAppend (HashState &h, Enum e)
 
template<class HashState , class T >
std::enable_if_t< std::is_floating_point< T >::value > TfHashAppend (HashState &h, T fp)
 
template<class HashState , class T , class U >
void TfHashAppend (HashState &h, std::pair< T, U > const &p)
 
template<class HashState , class... T>
void TfHashAppend (HashState &h, std::tuple< T... > const &t)
 
template<class HashState , class T >
void TfHashAppend (HashState &h, std::vector< T > const &vec)
 
template<class HashState >
void TfHashAppend (HashState &h, std::vector< bool > const &vec)
 
template<class HashState , class T , class Compare >
void TfHashAppend (HashState &h, std::set< T, Compare > const &elements)
 
template<class HashState , class Key , class Value , class Compare >
void TfHashAppend (HashState &h, std::map< Key, Value, Compare > const &elements)
 
template<class HashState >
void TfHashAppend (HashState &h, const std::string &s)
 
template<class HashState , class T >
void TfHashAppend (HashState &h, const T *ptr)
 
template<class HashState >
void TfHashAppend (HashState &h, char const *ptr)=delete
 
template<class HashState >
void TfHashAppend (HashState &h, char *ptr)=delete
 
TfCStrHashWrapper TfHashAsCStr (char const *cstr)
 Indicate that a char pointer is intended to be hashed as a C-style null terminated string.
 
template<class HashState >
void TfHashAppend (HashState &h, TfCStrHashWrapper hcstr)
 

Function Documentation

◆ TfHashAppend() [1/12]

void TfHashAppend ( HashState &  h,
const std::string &  s 
)
inline

Definition at line 130 of file hash.h.

◆ TfHashAppend() [2/12]

void TfHashAppend ( HashState &  h,
const T *  ptr 
)
inline

Definition at line 139 of file hash.h.

◆ TfHashAppend() [3/12]

std::enable_if_t< std::is_enum< Enum >::value > TfHashAppend ( HashState &  h,
Enum  e 
)

Definition at line 49 of file hash.h.

◆ TfHashAppend() [4/12]

void TfHashAppend ( HashState &  h,
std::map< Key, Value, Compare > const &  elements 
)
inline

Definition at line 122 of file hash.h.

◆ TfHashAppend() [5/12]

void TfHashAppend ( HashState &  h,
std::pair< T, U > const &  p 
)
inline

Definition at line 71 of file hash.h.

◆ TfHashAppend() [6/12]

void TfHashAppend ( HashState &  h,
std::set< T, Compare > const &  elements 
)
inline

Definition at line 112 of file hash.h.

◆ TfHashAppend() [7/12]

void TfHashAppend ( HashState &  h,
std::tuple< T... > const &  t 
)
inline

Definition at line 80 of file hash.h.

◆ TfHashAppend() [8/12]

void TfHashAppend ( HashState &  h,
std::vector< bool > const &  vec 
)
inline

Definition at line 102 of file hash.h.

◆ TfHashAppend() [9/12]

void TfHashAppend ( HashState &  h,
std::vector< T > const &  vec 
)
inline

Definition at line 91 of file hash.h.

◆ TfHashAppend() [10/12]

std::enable_if_t< std::is_floating_point< T >::value > TfHashAppend ( HashState &  h,
fp 
)

Definition at line 57 of file hash.h.

◆ TfHashAppend() [11/12]

std::enable_if_t< std::is_integral< T >::value > TfHashAppend ( HashState &  h,
integral 
)

Definition at line 33 of file hash.h.

◆ TfHashAppend() [12/12]

void TfHashAppend ( HashState &  h,
TfCStrHashWrapper  hcstr 
)
inline

Definition at line 176 of file hash.h.

◆ TfHashAsCStr()

TfCStrHashWrapper TfHashAsCStr ( char const *  cstr)
inline

Indicate that a char pointer is intended to be hashed as a C-style null terminated string.

Use this to wrap a char pointer in a HashState::Append() call when implementing a TfHashAppend overload.

This structure provides a lightweight view on the char pointer passed to its constructor. It does not copy the data or participate in its lifetime. The passed char pointer must remain valid as long as this struct is used.

Definition at line 170 of file hash.h.