Go to the previous, next section.
#include <nihcl/IdentSet.h>
An
IdentSet
(Identity Set) is similar to a
Set
, except that it uses
isSame()
for determining if an object already belongs to a
Set
. Instances of class
IdentSet
are useful in suppressing undesired multiple applications of member functions to class instances used as virtual base classes. For example, the
storeOn()
and
deepCopy()
operations use
IdentSet
s to prevent the members of a virtual base class from being stored or deepened, respectively, more than once.
IdentSet(unsigned
capacity
=DEFAULT_CAPACITY)
IdentSet
that can hold up to
capacity
objects. An
NIHCL_ALLOCSIZE
error is raised if
capacity
is not greater than 0. If an attempt is made to add more than
capacity
objects to an
IdentSet
,
reSize()
is called to increase its capacity. Since this is an expensive operation, it is wise to supply a reasonable estimate for
capacity.
virtual int findIndexOf(const Object&
ob) const
IdentSet
for an object that is
isSame()
as
ob
and returns the index of this object, if found, or the index of an empty slot (a slot containing a
nil
pointer) in the hash table where
ob
should be inserted.
virtual unsigned hashOf(const Object&
ob) const
Go to the previous, next section.