Tools.h++ Manual
22-108 104011 Tandem Computers Incorporated
22
For each item in the list this function will be called with the item as the first
argument. Client data may be passed through as parameter
d
.
size_t entries() const;
Returns the number of items that are currently in the collection.
RWBoolean find(const T& a, T& k) const;
Returns
TRUE
if the list contains an object that is equal to the object
a
and puts
a copy of the matching object into
k
. Returns
FALSE
otherwise and does not
touch
k
. Equality is measured by the class-defined equality operator. If you do
not need a copy of the found object, use
contains()
instead.
RWBoolean find(RWBoolean (*testFun)
(const T&, void*), void* d,
T& k) const;
Returns
TRUE
if the list contains an object for which the user-defined tester
function pointed to by
testFun
returns
TRUE
and puts a copy of the matching
object into
k
. Returns
FALSE
otherwise and does not touch
k
. The tester
function must have the prototype:
RWBoolean
yourTester
(const T&, void* d);
For each item in the list this function will be called with the item as the first
argument. Client data may be passed through as parameter
d
. If you do not
need a copy of the found object, use
contains()
instead.
T first() const;
Returns (but does not remove) the first item in the list. The behavior is
undefined if the list is empty.
T get();
Returns and removes the first item in the list. The behavior is undefined if the
list is empty.
size_t index(const T& a);
Returns the index of the first object that is equal to the object
a
, or
RW_NPOS
if
there is no such object. Equality is measured by the class-defined equality
operator.
size_t index(RWBoolean (*testFun)
(const T&, void*), void* d)
const;