Tools.h++ Class Reference

Table Of Contents
struct Symbol : public RWIsvSlink
{ char name[10];
Symbol( const char* cs)
{ strncpy(name, cs, sizeof(name)); name[9] = '\0'; }
};
void printem(Symbol* s, void*) { cout << s->name << endl; }
main(){
RWTIsvSlist<Symbol> list;
list.insert( new Symbol("one") );
list.insert( new Symbol("two") );
list.prepend( new Symbol("zero") );
list.apply(printem, 0);
list.clearAndDestroy(); // Deletes the items inserted into
// the list
return 0;
}
Program Output:
zero
one
two
Public Constructors
RWTIsvSlist();
Constructs an empty list.
RWTIsvSlist(T* a);
Constructs a list with the single item pointed to by a in it.
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);
Calls the function pointed to by applyFun to every item in the collection. This must have
the prototype:
void yourFun(T* item, void* d);