about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2014-01-13 00:25:30 -0800
committerYehuda Katz <wycats@gmail.com>2014-01-13 02:21:19 -0800
commit8f6ffdefc3328f011695bc0f6c3fd0d36b178dd1 (patch)
treed1e4d42c14ef68696d08f79b65045a2703087c01
parentb93a4dac2e52b67faf778957ba7a997e805d103b (diff)
downloadrust-8f6ffdefc3328f011695bc0f6c3fd0d36b178dd1.tar.gz
rust-8f6ffdefc3328f011695bc0f6c3fd0d36b178dd1.zip
Add Clone to TreeSet
-rw-r--r--src/libextra/treemap.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs
index 5a8cd94c9e9..8f1bd3a9df1 100644
--- a/src/libextra/treemap.rs
+++ b/src/libextra/treemap.rs
@@ -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],