KiCad PCB EDA Suite
std::hash< wxPoint > Struct Template Reference

#include <wx_stl_compat.h>

Public Member Functions

size_t operator() (const wxPoint &k) const
 

Detailed Description

template<>
struct std::hash< wxPoint >

Definition at line 44 of file wx_stl_compat.h.

Member Function Documentation

◆ operator()()

size_t std::hash< wxPoint >::operator() ( const wxPoint &  k) const

Definition at line 32 of file wx_stl_compat.cpp.

33 {
34  auto xhash = std::hash<int>()( k.x );
35 
36  // 0x9e3779b9 is 2^33 / ( 1 + sqrt(5) )
37  // Adding this value ensures that consecutive bits of y will not be close to each other
38  // decreasing the likelihood of hash collision in similar values of x and y
39  return xhash ^ ( std::hash<int>()( k.y ) + 0x9e3779b9 + ( xhash << 6 ) + ( xhash >> 2 ) );
40 }

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