std::hashmap: Remove BaseIter impl for HashSet

Remove the BaseIter impl, while keeping the .each method until callers
are converted.
This commit is contained in:
blake2-ppc 2013-06-21 17:05:29 +02:00 committed by Daniel Micay
parent f045210857
commit 13f666a724

View File

@ -18,7 +18,6 @@
use container::{Container, Mutable, Map, Set};
use cmp::{Eq, Equiv};
use hash::Hash;
use old_iter::BaseIter;
use iterator::{Iterator, IteratorUtil};
use option::{None, Option, Some};
use rand::RngUtil;
@ -622,12 +621,6 @@ pub struct HashSet<T> {
priv map: HashMap<T, ()>
}
impl<T:Hash + Eq> BaseIter<T> for HashSet<T> {
/// Visit all values in order
fn each(&self, f: &fn(&T) -> bool) -> bool { self.map.each_key(f) }
fn size_hint(&self) -> Option<uint> { Some(self.len()) }
}
impl<T:Hash + Eq> Eq for HashSet<T> {
fn eq(&self, other: &HashSet<T>) -> bool { self.map == other.map }
fn ne(&self, other: &HashSet<T>) -> bool { self.map != other.map }
@ -725,6 +718,12 @@ impl<T:Hash + Eq> HashSet<T> {
self.map.contains_key_equiv(value)
}
/// Visit all elements in arbitrary order
/// FIXME: Remove when all callers are converted
pub fn each(&self, f: &fn(&T) -> bool) -> bool {
self.iter().advance(f)
}
/// An iterator visiting all elements in arbitrary order.
/// Iterator element type is &'a T.
pub fn iter<'a>(&'a self) -> HashSetIterator<'a, T> {