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
:: lists occurrences of characters in the string c++ 
:: declare a tab c++ 
::  
::  
::  
Cpp ::  
Cpp ::  
::  
:: how to find size of int in c++ 
:: or in c++ 
::  
::  
::  
::  
::  
:: if else c++ 
:: pause the console c++ 
::  
Cpp ::  
::  
::  
::  
::  
::  
::  
::  
::  
Cpp ::  
::  
Cpp ::  
ADD CONTENT
Topic
Content
Source link
Name
7+7 =