about summary refs log tree commit diff
path: root/src/rt/rust_exchange_alloc.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-12 11:53:18 -0700
committerbors <bors@rust-lang.org>2013-08-12 11:53:18 -0700
commit35040275b3f39618c3cec4a9f702b6e057309604 (patch)
tree18153f0a059cbadb4672f6cff56227eccae18271 /src/rt/rust_exchange_alloc.cpp
parent59434a1b8c83b3c243556038578736ebde02a3e8 (diff)
parent854e219d0aff3eff1f0b3762efc2d1a05ebb426b (diff)
downloadrust-35040275b3f39618c3cec4a9f702b6e057309604.tar.gz
rust-35040275b3f39618c3cec4a9f702b6e057309604.zip
auto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmr
Use Eq + Ord for lexicographical ordering of sequences.

For each of <, <=, >= or > as R, use::

    [x, ..xs] R [y, ..ys]  =  if x != y { x R y } else { xs R ys }

Previous code using `a < b` and then `!(b < a)` for short-circuiting
fails on cases such as  [1.0, 2.0] < [0.0/0.0, 3.0], where the first
element was effectively considered equal.

Containers like &[T] did also implement only one comparison operator `<`,
and derived the comparison results from this. This isn't correct either for
Ord.

Implement functions in `std::iterator::order::{lt,le,gt,ge,equal,cmp}` that all
iterable containers can use for lexical order.

We also visit tuple ordering, having the same problem and same solution
(but differing implementation).
Diffstat (limited to 'src/rt/rust_exchange_alloc.cpp')
0 files changed, 0 insertions, 0 deletions