HexMapLibrary
Public Member Functions | List of all members
Wunderwunsch.HexMapLibrary.Vector3IntEqualityComparer Class Reference

Add this as custom IEqualityComparer to any Dictionary using Vector3Int as key, this is unfortunately necessary to prevent boxing (and therefore memory allocations) as Unity omitted to implement the IEquatable<Vector3Int> interface on Vector3Int Will be obsolete with 2018.2 :-) More...

Inheritance diagram for Wunderwunsch.HexMapLibrary.Vector3IntEqualityComparer:

Public Member Functions

bool Equals (Vector3Int v1, Vector3Int v2)
 strongly typed equality comparison removing the need to cast to object More...
 
int GetHashCode (Vector3Int v)
 HashCode implementation equal to the one Vector3Int uses. More...
 

Detailed Description

Add this as custom IEqualityComparer to any Dictionary using Vector3Int as key, this is unfortunately necessary to prevent boxing (and therefore memory allocations) as Unity omitted to implement the IEquatable<Vector3Int> interface on Vector3Int Will be obsolete with 2018.2 :-)

Member Function Documentation

◆ Equals()

bool Wunderwunsch.HexMapLibrary.Vector3IntEqualityComparer.Equals ( Vector3Int  v1,
Vector3Int  v2 
)

strongly typed equality comparison removing the need to cast to object

◆ GetHashCode()

int Wunderwunsch.HexMapLibrary.Vector3IntEqualityComparer.GetHashCode ( Vector3Int  v)

HashCode implementation equal to the one Vector3Int uses.