123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import hashes
- type
- Obj* = object
- x*, y*: int
- z*: string # to be ignored for equality
- proc `==`*(a, b: Obj): bool =
- a.x == b.x and a.y == b.y
- proc hash*(a: Obj): Hash =
- !$(hash(a.x) !& hash(a.y))
- type
- RefObj* = ref object
- x*, y*: int
- z*: string # to be ignored for equality
- proc `==`*(a, b: RefObj): bool =
- a.x == b.x and a.y == b.y
- proc hash*(a: RefObj): Hash =
- !$(hash(a.x) !& hash(a.y))
- type
- GenericObj1*[T] = object
- x*, y*: T
- z*: string # to be ignored for equality
- proc `==`*[T](a, b: GenericObj1[T]): bool =
- a.x == b.x and a.y == b.y
- proc hash*[T](a: GenericObj1[T]): Hash =
- !$(hash(a.x) !& hash(a.y))
- type
- GenericObj2*[T] = object
- x*, y*: T
- z*: string # to be ignored for equality
- proc `==`*(a, b: GenericObj2): bool =
- a.x == b.x and a.y == b.y
- proc hash*(a: GenericObj2): Hash =
- !$(hash(a.x) !& hash(a.y))
- type
- GenericObj3*[T] = object
- x*, y*: T
- z*: string # to be ignored for equality
- GenericObj3Alias*[T] = GenericObj3[T]
- proc `==`*[T](a, b: GenericObj3Alias[T]): bool =
- a.x == b.x and a.y == b.y
- proc hash*[T](a: GenericObj3Alias[T]): Hash =
- !$(hash(a.x) !& hash(a.y))
- type
- GenericObj4*[T] = object
- x*, y*: T
- z*: string # to be ignored for equality
- GenericObj4Alias*[T] = GenericObj4[T]
- proc `==`*(a, b: GenericObj4): bool =
- a.x == b.x and a.y == b.y
- proc hash*(a: GenericObj4): Hash =
- !$(hash(a.x) !& hash(a.y))
- type
- GenericRefObj*[T] = ref object
- x*, y*: T
- z*: string # to be ignored for equality
- proc `==`*[T](a, b: GenericRefObj[T]): bool =
- a.x == b.x and a.y == b.y
- proc hash*[T](a: GenericRefObj[T]): Hash =
- !$(hash(a.x) !& hash(a.y))
|