Add Clone to TreeSet
This commit is contained in:
parent
b93a4dac2e
commit
8f6ffdefc3
1 changed files with 11 additions and 0 deletions
|
@ -549,6 +549,7 @@ impl<'a, T> Iterator<&'a T> for TreeSetRevIterator<'a, T> {
|
||||||
/// A implementation of the `Set` trait on top of the `TreeMap` container. The
|
/// A implementation of the `Set` trait on top of the `TreeMap` container. The
|
||||||
/// only requirement is that the type of the elements contained ascribes to the
|
/// only requirement is that the type of the elements contained ascribes to the
|
||||||
/// `TotalOrd` trait.
|
/// `TotalOrd` trait.
|
||||||
|
#[deriving(Clone)]
|
||||||
pub struct TreeSet<T> {
|
pub struct TreeSet<T> {
|
||||||
priv map: TreeMap<T, ()>
|
priv map: TreeMap<T, ()>
|
||||||
}
|
}
|
||||||
|
@ -1588,6 +1589,16 @@ mod test_set {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_clone_eq() {
|
||||||
|
let mut m = TreeSet::new();
|
||||||
|
|
||||||
|
m.insert(1);
|
||||||
|
m.insert(2);
|
||||||
|
|
||||||
|
assert!(m.clone() == m);
|
||||||
|
}
|
||||||
|
|
||||||
fn check(a: &[int],
|
fn check(a: &[int],
|
||||||
b: &[int],
|
b: &[int],
|
||||||
expected: &[int],
|
expected: &[int],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue