7105611: Set::print() is broken

Reimplemented class VSetI_ to restore Set::print().

Reviewed-by: never
This commit is contained in:
Vladimir Kozlov 2011-10-27 18:20:50 -07:00
parent 5a2f55d0e0
commit 762ad9c51c
2 changed files with 16 additions and 1 deletions

View File

@ -350,6 +350,21 @@ int VectorSet::hash() const
return (int)_xor;
}
//------------------------------iterate----------------------------------------
// Used by Set::print().
class VSetI_ : public SetI_ {
VectorSetI vsi;
public:
VSetI_( const VectorSet *vset, uint &elem ) : vsi(vset) { elem = vsi.elem; }
uint next(void) { ++vsi; return vsi.elem; }
int test(void) { return vsi.test(); }
};
SetI_ *VectorSet::iterate(uint &elem) const {
return new(ResourceObj::C_HEAP) VSetI_(this, elem);
}
//=============================================================================
//------------------------------next-------------------------------------------
// Find and return the next element of a vector set, or return garbage and

View File

@ -151,7 +151,7 @@ public:
private:
SetI_ *iterate(uint&) const { ShouldNotCallThis(); return NULL; } // Removed
SetI_ *iterate(uint&) const;
};
//------------------------------Iteration--------------------------------------