All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
VectorHasher< Int > Struct Template Reference

A hashing function-object for vectors. More...

#include <stl-utils.h>

Collaboration diagram for VectorHasher< Int >:

Public Member Functions

size_t operator() (const std::vector< Int > &x) const noexcept
 
 VectorHasher ()
 

Static Private Attributes

static const int kPrime = 7853
 

Detailed Description

template<typename Int>
struct kaldi::VectorHasher< Int >

A hashing function-object for vectors.

Definition at line 218 of file stl-utils.h.

Constructor & Destructor Documentation

VectorHasher ( )
inline

Definition at line 228 of file stl-utils.h.

References KALDI_ASSERT_IS_INTEGER_TYPE.

228  { // Check we're instantiated with an integer type.
230  }
#define KALDI_ASSERT_IS_INTEGER_TYPE(I)
Definition: kaldi-utils.h:129

Member Function Documentation

size_t operator() ( const std::vector< Int > &  x) const
inlinenoexcept

Definition at line 219 of file stl-utils.h.

References VectorHasher< Int >::kPrime.

219  {
220  size_t ans = 0;
221  typename std::vector<Int>::const_iterator iter = x.begin(), end = x.end();
222  for (; iter != end; ++iter) {
223  ans *= kPrime;
224  ans += *iter;
225  }
226  return ans;
227  }
static const int kPrime
Definition: stl-utils.h:232

Member Data Documentation

const int kPrime = 7853
staticprivate

Definition at line 232 of file stl-utils.h.

Referenced by VectorHasher< Int >::operator()().


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