std: implement Total{Ord,Eq} for pointers.

This commit is contained in:
Huon Wilson
2013-07-28 01:25:30 +10:00
parent 8407ec9fed
commit 88620c25f5
3 changed files with 49 additions and 2 deletions

View File

@@ -10,7 +10,7 @@
//! Operations on unique pointer types
#[cfg(not(test))] use cmp::{Eq, Ord};
#[cfg(not(test))] use cmp::*;
#[cfg(not(test))]
impl<T:Eq> Eq for ~T {
@@ -31,3 +31,15 @@ impl<T:Ord> Ord for ~T {
#[inline]
fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
}
#[cfg(not(test))]
impl<T: TotalOrd> TotalOrd for ~T {
#[inline]
fn cmp(&self, other: &~T) -> Ordering { (**self).cmp(*other) }
}
#[cfg(not(test))]
impl<T: TotalEq> TotalEq for ~T {
#[inline]
fn equals(&self, other: &~T) -> bool { (**self).equals(*other) }
}