Add PartialOrd and Ord implementation for ArrayVec

This commit is contained in:
Tobias Bucher
2015-09-10 13:51:47 +01:00
parent 876c7c049b
commit 1737a24e0d
+13
View File
@@ -1,6 +1,7 @@
extern crate odds;
extern crate nodrop;
use std::cmp;
use std::iter;
use std::mem;
use std::ptr;
@@ -642,3 +643,15 @@ impl<A: Array> Default for ArrayVec<A> {
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)
}
}