Skip to content

Commit

Permalink
Merge pull request #151 from dn-m/newtype
Browse files Browse the repository at this point in the history
Add Equatable and Hashable conformance to NewType
  • Loading branch information
jsbean authored Aug 20, 2018
2 parents b2a7283 + d5a98fe commit f9bf1e3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/DataStructures/NewType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ extension NewType {
}
}

extension NewType where Value: Equatable {
public static func == (lhs: Self, rhs: Self) -> Bool {
return lhs.value == rhs.value
}
}

extension NewType where Value: Hashable {
public var hashValue: Int {
return value.hashValue
}
}

extension NewType where Value: Comparable {
public static func < (lhs: Self, rhs: Self) -> Bool {
return lhs.value < rhs.value
Expand Down

0 comments on commit f9bf1e3

Please sign in to comment.