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
 
 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 230 of file stl-utils.h.

Constructor & Destructor Documentation

VectorHasher ( )
inline

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

References KALDI_ASSERT_IS_INTEGER_TYPE.

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

Member Function Documentation

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

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

References VectorHasher< Int >::kPrime.

231  {
232  size_t ans = 0;
233  typename std::vector<Int>::const_iterator iter = x.begin(), end = x.end();
234  for (; iter != end; ++iter) {
235  ans *= kPrime;
236  ans += *iter;
237  }
238  return ans;
239  }
static const int kPrime
Definition: stl-utils.h:244

Member Data Documentation

const int kPrime = 7853
staticprivate

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

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


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