Skip to content

Commit f9bf1e3

Browse files
authored
Merge pull request #151 from dn-m/newtype
Add Equatable and Hashable conformance to NewType
2 parents b2a7283 + d5a98fe commit f9bf1e3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/DataStructures/NewType.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ extension NewType {
1717
}
1818
}
1919

20+
extension NewType where Value: Equatable {
21+
public static func == (lhs: Self, rhs: Self) -> Bool {
22+
return lhs.value == rhs.value
23+
}
24+
}
25+
26+
extension NewType where Value: Hashable {
27+
public var hashValue: Int {
28+
return value.hashValue
29+
}
30+
}
31+
2032
extension NewType where Value: Comparable {
2133
public static func < (lhs: Self, rhs: Self) -> Bool {
2234
return lhs.value < rhs.value

0 commit comments

Comments
 (0)