From d08791c6549b95659daf66b0ff927d774d4bf1f3 Mon Sep 17 00:00:00 2001 From: James Bean Date: Wed, 28 Aug 2019 15:12:48 -0400 Subject: [PATCH] Add conformances to AVLTree --- Sources/DataStructures/AVLTree.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/DataStructures/AVLTree.swift b/Sources/DataStructures/AVLTree.swift index 014914d..6ea961e 100644 --- a/Sources/DataStructures/AVLTree.swift +++ b/Sources/DataStructures/AVLTree.swift @@ -215,4 +215,12 @@ extension AVLTree: ExpressibleByArrayLiteral { } } +extension AVLTree.Node: Hashable where Key: Hashable, Value: Hashable { + /// Uses the `ObjectIdentifier` of this `Node` to determine hashing. + public func hash(into hasher: inout Hasher) { + hasher.combine(ObjectIdentifier(self)) + } +} + extension AVLTree: Equatable where Value: Equatable { } +extension AVLTree: Hashable where Key: Hashable, Value: Hashable { }