We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c22182f + 510f3da commit 2c47dc3Copy full SHA for 2c47dc3
Graph/Graph/Edge.swift
@@ -29,12 +29,10 @@ extension Edge: CustomStringConvertible {
29
30
extension Edge: Hashable {
31
32
- public var hashValue: Int {
33
- var string = "\(from.description)\(to.description)"
34
- if weight != nil {
35
- string.append("\(weight!)")
36
- }
37
- return string.hashValue
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(from.description)
+ hasher.combine(to.description)
+ hasher.combine(weight)
38
}
39
40
Graph/Graph/Vertex.swift
@@ -24,8 +24,9 @@ extension Vertex: CustomStringConvertible {
24
25
extension Vertex: Hashable {
26
27
28
- return "\(data)\(index)".hashValue
+ hasher.combine(data)
+ hasher.combine(index)
0 commit comments