Tools.h++ Class Reference

Table Of Contents
C++-standard header file <functional> is an example.
RWTValSet<T,C> will not accept an item that compares equal to an item already in the
collection. (RWTValMultiSet<T,C> may contain multiple items that compare equal to each
other.) Equality is based on the comparison object and not on the == operator. Given a
comparison object comp, items a and b are equal if
!comp(a,b) && !comp(b,a).
Persistence
Isomorphic.
Examples
In this example, a set of RWCStrings is exercised.
//
// tvsstr.cpp
//
#include <rw/tvset.h>
#include <rw/cstring.h>
#include <iostream.h>
#include <function.h>
main(){
RWTValSet<RWCString,less<RWCString> > set;
set.insert("one");
set.insert("two");
set.insert("three");
set.insert("one"); // Rejected: already in collection
cout << set.entries() << endl; // Prints "3"
return 0;
}
Related Classes
Class RWTValMultiSet<T,C> offers the same interface to a collection that accepts multiple
items that compare equal to each other. RWTValMap<K,T,C> maintains a collection of
key-value pairs.
Class set<T,C,allocator> is the C++-standard collection that serves as the underlying
implementation for RWTValSet<T,C>.