Mixin of the specialized iterator classes which inherit from
BucketSet.Iterator.
This makes available three iterator classes that can be newed to allow
certain iteration behaviors:
* Iterator — just a normal iterator
* InterruptibleIterator — an iterator that can be interrupted and
resumed, but that has to be manually reset with reset() if the
iteration is meant to be repeated
If the map is modified between interrupted iterations, it can happen
that new elements that were added in the mean time won't appear in the
iteratation, depending on whether they end up in a bucket that was
already iterated or not.
Iterator usage example
automap = newHashMap!(size_t);
autoit = map.newIterator();
// A normal iteration over the mapforeach ( k, v; it )
{
..
}
// Equal toforeach ( k, v; map )
{
..
}
InterruptibleIterator
automap = newHashMap!(size_t);
autointerruptible_it = map.newInterruptibleIterator();
// Iterate over the first 100k elementsforeach ( i, k, v; interruptible_it )
{
..
// Break after 100k elementsif ( i % 100_000 == 0 ) break;
}
// Iterate over the next 100k elmentsforeach ( i, k, v; interruptible_it )
{
..
// Break after 100k elementsif ( i % 100_000 == 0 ) break;
}
// Assuming the map had 150k elements, the iteration is done now,// so this won't do anythingforeach ( i, k, v; interruptible_it )
{
..
// Break after 100k elementsif ( i % 100_000 == 0 ) break;
}
assert ( interruptible_it.finished() == true );
See also: BucketSet.Iterator, MapIterator.IteratorClass
Mixin of the specialized iterator classes which inherit from BucketSet.Iterator.
This makes available three iterator classes that can be newed to allow certain iteration behaviors:
* Iterator — just a normal iterator * InterruptibleIterator — an iterator that can be interrupted and resumed, but that has to be manually reset with reset() if the iteration is meant to be repeated
If the map is modified between interrupted iterations, it can happen that new elements that were added in the mean time won't appear in the iteratation, depending on whether they end up in a bucket that was already iterated or not.
Iterator usage example
InterruptibleIterator
See also: BucketSet.Iterator, MapIterator.IteratorClass