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

#include <common.h>

Public Member Functions

size_t operator() (const wxPoint &k) const
 

Detailed Description

template<>
struct std::hash< wxPoint >

Definition at line 380 of file common.h.

Member Function Documentation

◆ operator()()

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

Definition at line 711 of file common.cpp.

712 {
713  auto xhash = std::hash<int>()( k.x );
714 
715  // 0x9e3779b9 is 2^33 / ( 1 + sqrt(5) )
716  // Adding this value ensures that consecutive bits of y will not be close to each other
717  // decreasing the likelihood of hash collision in similar values of x and y
718  return xhash ^ ( std::hash<int>()( k.y ) + 0x9e3779b9 + ( xhash << 6 ) + ( xhash >> 2 ) );
719 }

References wxPoint::x, and wxPoint::y.


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