From 8f6ffdefc3328f011695bc0f6c3fd0d36b178dd1 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 13 Jan 2014 00:25:30 -0800 Subject: [PATCH] Add Clone to TreeSet --- src/libextra/treemap.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs index 5a8cd94c9e9a7..8f1bd3a9df1a0 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 { priv map: TreeMap } @@ -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],