Merge pull request #11 from tbu-/pr_ord

Add `PartialOrd` and `Ord` implementation for `ArrayVec`
This commit is contained in:
bluss
2015-09-10 15:09:06 +02:00
+13
View File
@@ -1,6 +1,7 @@
extern crate odds; extern crate odds;
extern crate nodrop; extern crate nodrop;
use std::cmp;
use std::iter; use std::iter;
use std::mem; use std::mem;
use std::ptr; use std::ptr;
@@ -642,3 +643,15 @@ impl<A: Array> Default for ArrayVec<A> {
ArrayVec::new() ArrayVec::new()
} }
} }
impl<A: Array> PartialOrd for ArrayVec<A> where A::Item: PartialOrd {
fn partial_cmp(&self, other: &ArrayVec<A>) -> Option<cmp::Ordering> {
(**self).partial_cmp(other)
}
}
impl<A: Array> Ord for ArrayVec<A> where A::Item: Ord {
fn cmp(&self, other: &ArrayVec<A>) -> cmp::Ordering {
(**self).cmp(other)
}
}