The Comparable protocol requires that < and == impose a strict total order: 
exactly one of a==b, a<b, a>b must hold for all values a and b of a conforming 
type.

But it is also noted that a conforming type may contain a subset of 
„exceptional values“ which do not take part in the strict total order (such as 
FloatingPoint.nan).

What does that mean for functions taking comparable arguments, e.g.

    func mySuperSort<T: Comparable>(a: inout [T]) { }

Can the function implementation assume that all values passed to it take part 
in the strict total order? In other words: „exceptional values“ must not be 
passed to the function?

Or must the function take that case into account and must not assume that 
exactly one of a==b, a<b, a>b holds for any arguments passed to it?

Regards, Martin




_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to