Tools.h++ Class Reference

Table Of Contents
which returns true if x and its partner should precede y and its partner within the collection. The
structure less<T> from the C++-standard header file <functional> is an example. Note that keys
will be dereferenced before being compared.
RWTPtrMap<K,T,C> will not accept a key that compares equal to any key already in the
collection. (RWTPtrMultiMap<K,T,C> may contain multiple keys that compare equal to each
other.) Equality is based on the comparison object and not on the == operator. Given a
comparison object comp, keys a and b are equal if
!comp(a,b) && !comp(b,a).
Persistence
Isomorphic.
Examples
In this example, a map of RWCStrings and RWDates is exercised.
//
// tpmap.cpp
//
#include <rw/tpmap.h>
#include <rw/cstring.h>
#include <rw/rwdate.h>
#include <iostream.h>
#include <function.h>
main(){
RWTPtrMap<RWCString, RWDate, less<RWCString> > birthdays;
birthdays.insert
(
new RWCString("John"),
new RWDate(12, "April", 1975)
);
birthdays.insert
(
new RWCString("Ivan"),
new RWDate(2, "Nov", 1980)
);
// Alternative syntax:
birthdays[new RWCString("Susan")] =
new RWDate(30, "June", 1955);
birthdays[new RWCString("Gene")] =