Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ custom hash

namespace std {

  template <>
  struct hash<Key>
  {
    std::size_t operator()(const Key& k) const
    {
      using std::size_t;
      using std::hash;
      using std::string;

      // Compute individual hash values for first,
      // second and third and combine them using XOR
      // and bit shifting:

      return ((hash<string>()(k.first)
               ^ (hash<string>()(k.second) << 1)) >> 1)
               ^ (hash<int>()(k.third) << 1);
    }
  };

}
Comment

PREVIOUS NEXT
Code Example
Cpp :: recursive factorial of a number 
Cpp :: read a whole line from the input 
Cpp :: 344. reverse string c++ 
Cpp :: c++ compare type 
Cpp :: how to declare an enum variable c++ 
Cpp :: c++ std map initializer list 
Cpp :: move assignment operator c++ 
Cpp :: assign one vector to another c++ 
Cpp :: find nth fibonacci number 
Cpp :: unordered_map c++ 
Cpp :: c++ if else example 
Cpp :: web dev c++ 
Cpp :: c++ program to find gcd of 3 numbers 
Cpp :: for_each c++ 
Cpp :: C++ Vector Operation Delete Elements 
Cpp :: abs in c++ used for 
Cpp :: max circular subarray sum gfg practice 
Cpp :: file streams in c++ 
Cpp :: vector of vectors c++ 
Cpp :: Initialize Vector Iterator with end() function 
Cpp :: C++ Vector Initialization method 03 
Cpp :: Write a C++ program to Computing Mean and Median Using Arrays 
Cpp :: solve problem of getline 
Cpp :: find no of occurences of each letter in string c++ 
Cpp :: The Rating Dilemma codechef solution in c++ 
Cpp :: switch cout print with a prameter c++ 
Cpp :: c++ program for inflation rate of two numbers 
Cpp :: convert datatype of field db browser from text to timedate db browser 
Cpp :: comentar todas linhas de uma vez vs code 
Cpp :: Equalize problem codeforces 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =