Add PartialOrd and Ord implementation for ArrayVec
This commit is contained in:
+13
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user