diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/treemap.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index b1c22f86c96..235db263542 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -29,10 +29,10 @@ use core::prelude::*; // range search - O(log n) retrieval of an iterator from some key // (possibly) implement the overloads Python does for sets: -// * union: | // * intersection: & // * difference: - // * symmetric difference: ^ +// * union: | // These would be convenient since the methods work like `each` pub struct TreeMap<K, V> { @@ -355,22 +355,6 @@ impl <T: Ord> TreeSet<T>: Set<T> { } true } -} - -impl <T: Ord> TreeSet<T> { - /// Create an empty TreeSet - static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} } - - /// Visit all values in reverse order - pure fn each_reverse(&self, f: fn(&T) -> bool) { - self.map.each_key_reverse(f) - } - - /// Get a lazy iterator over the values in the set. - /// Requires that it be frozen (immutable). - pure fn iter(&self) -> TreeSetIterator/&self<T> { - TreeSetIterator{iter: self.map.iter()} - } /// Visit the values (in-order) representing the difference pure fn difference(&self, other: &TreeSet<T>, f: fn(&T) -> bool) { @@ -448,6 +432,22 @@ impl <T: Ord> TreeSet<T> { } } } +} + +impl <T: Ord> TreeSet<T> { + /// Create an empty TreeSet + static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} } + + /// Visit all values in reverse order + pure fn each_reverse(&self, f: fn(&T) -> bool) { + self.map.each_key_reverse(f) + } + + /// Get a lazy iterator over the values in the set. + /// Requires that it be frozen (immutable). + pure fn iter(&self) -> TreeSetIterator/&self<T> { + TreeSetIterator{iter: self.map.iter()} + } /// Visit the values (in-order) representing the intersection pure fn intersection(&self, other: &TreeSet<T>, f: fn(&T) -> bool) { |
