Tools.h++ Class Reference

Table Of Contents
Constructs a new singly-linked list as a shallow copy of c. After construction, pointers will be
shared between the two collections.
Public Operators
RWTPtrSlist&
operator=(const RWTPtrSlist<T>& c);
Sets self to a shallow copy of c. Afterwards, pointers will be shared between the two collections.
T*&
operator[](size_t i);
T* const&
operator[](size_t i) const;
Returns a pointer to the ith value in the list. The first variant can be used as an lvalue, the second
cannot. The index i must be between zero and the number of items in the collection less one, or
an exception of type RWBoundsError will be thrown.
Public Member Functions
void
append(T* a);
Appends the item pointed to by a to the end of the list.
void
apply(void (*applyFun)(T*, void*), void* d);
Applies the user-defined function pointed to by applyFun to every item in the list. This function
must have the prototype:
void yourFun(T* a, void* d);
This function will be called for each item in the list, with a pointer to the item as the first
argument. Client data may be passed through as parameter d.
T*&
at(size_t i);
T* const;
at(size_t i) const;
Returns a pointer to the ith value in the list. The first variant can be used as an lvalue, the second
cannot. The index i must be between zero and the number of items in the collection less one, or
an exception of type RWBoundsError will be thrown.
void
clear();
Removes all items from the collection.
void
clearAndDestroy();
Removes all items from the collection and deletes them.