Add Clone to TreeSet

This commit is contained in:
Yehuda Katz 2014-01-13 00:25:30 -08:00
parent b93a4dac2e
commit 8f6ffdefc3
1 changed files with 11 additions and 0 deletions

View File

@ -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
/// only requirement is that the type of the elements contained ascribes to the
/// `TotalOrd` trait.
#[deriving(Clone)]
pub struct TreeSet<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],
b: &[int],
expected: &[int],