libcore: Implement equality for pointers
This commit is contained in:
parent
5792244d03
commit
9c04454e7b
1 changed files with 6 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ export buf_len;
|
|||
export position;
|
||||
export Ptr;
|
||||
|
||||
import cmp::Eq;
|
||||
import libc::{c_void, size_t};
|
||||
|
||||
#[nolink]
|
||||
|
|
@ -170,6 +171,11 @@ impl<T> *T: Ptr {
|
|||
pure fn is_not_null() -> bool { is_not_null(self) }
|
||||
}
|
||||
|
||||
// Equality for pointers
|
||||
impl<T: Eq> *T : Eq {
|
||||
pure fn eq(&&other: *T) -> bool { self == other }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
unsafe {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue