On 2016-04-15 Dmitri Gribenko wrote:
On Fri, Apr 15, 2016 at 1:30 PM, Stephan Tolksdorf <[email protected]> wrote:
The proposal requires Index values to be Comparable. Does that mean that
indices from different collection instances should be comparable i.e. have a
strict total order?
No, comparing indices from unrelated instances produces unspecified
results (incl. traps).
And somewhat related: Is it safe in Swift (in contrast to C) to compare
NativePointers into unrelated memory blocks?
Unfortunately, I don't know, but I'd like to know the answer, too :)
I don't think this is documented anywhere though, so it is technically
unspecified.
Thanks for your reply!
These kind of type-specific special preconditions for the Comparable
protocol probably should be documented more prominently. A similar case
is the behaviour of the Comparable implementation for floats when NaNs
are involved.
- Stephan
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution