Rhino C++ API  9.0
Public Member Functions | List of all members
ON_UuidHasher Class Reference

#include <opennurbs_uuid.h>

Public Member Functions

size_t operator() (const ON_UUID &uuid) const
 

Detailed Description

Description: Hash functor for using ON_UUID as a key in std::unordered_map / std::unordered_set. Object ids are effectively random, so hashing the first 8 bytes gives a well-distributed 64-bit hash without the cost of mixing all 16 bytes. Example: std::unordered_map<ON_UUID, int, ON_UuidHasher> map;

Member Function Documentation

◆ operator()()

size_t ON_UuidHasher::operator() ( const ON_UUID uuid) const
inline

Read two 32-bit words (Data1, and Data2/Data3) with 4-byte-aligned reads - NOT a size_t* cast, since ON_UUID is only guaranteed 4-byte aligned.