dlist: Use Ord for .insert_ordered()
We don't need TotalOrd for ordered insertion, just the normal sort order Ord.
This commit is contained in:
parent
b1a071e314
commit
21adfd5645
1 changed files with 2 additions and 3 deletions
|
@ -23,7 +23,6 @@
|
|||
// the reverse direction.
|
||||
|
||||
use std::cast;
|
||||
use std::cmp;
|
||||
use std::ptr;
|
||||
use std::util;
|
||||
use std::iterator::{FromIterator, InvertIterator};
|
||||
|
@ -396,13 +395,13 @@ impl<T> DList<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: cmp::TotalOrd> DList<T> {
|
||||
impl<T: Ord> DList<T> {
|
||||
/// Insert `elt` sorted in ascending order
|
||||
///
|
||||
/// O(N)
|
||||
#[inline]
|
||||
pub fn insert_ordered(&mut self, elt: T) {
|
||||
self.insert_when(elt, |a, b| a.cmp(b) != cmp::Less);
|
||||
self.insert_when(elt, |a, b| a >= b)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue