Comparable

protocol Comparable<RHS>

Defines ordering predicates compatible with a type's equality semantics.

Conformers implement gt; defaults derive the other relations assuming ordinary trichotomy. Types with unordered values must override those defaults, as Float does for NaN, so each predicate preserves the underlying comparison semantics.

Methods

func gt(_ rhs: RHS) -> Bool

Returns whether Self is greater than RHS; defaults derive the other relations from gt.

View Source
func gt(_ rhs: RHS) -> Bool

func gte(_ rhs: RHS) -> Bool

Returns whether Self is greater than or equal to RHS.

View Source
func gte(_ rhs: RHS) -> Bool {
	self.gt(rhs) || self.equals(rhs)
}

func lt(_ rhs: RHS) -> Bool

Returns whether Self is less than RHS; defaults derive the other relations from gt.

View Source
func lt(_ rhs: RHS) -> Bool {
	!self.gt(rhs) && !self.equals(rhs)
}

func lte(_ rhs: RHS) -> Bool

Returns whether Self is less than or equal to RHS.

View Source
func lte(_ rhs: RHS) -> Bool {
	self.equals(rhs) || !self.gt(rhs)
}