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.
RWTValMap<K,T,C> will not accept a key that compares equal to any key already in the
collection. (RWTValMultiMap<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.
//
// tvmbday.cpp
//
#include <rw/tvmap.h>
#include <rw/cstring.h>
#include <rw/rwdate.h>
#include <iostream.h>
main(){
RWTValMap<RWCString, RWDate, less<RWCString> > birthdays;
birthdays.insert("John", RWDate(12, "April",1975));
birthdays.insert("Ivan", RWDate(2, "Nov", 1980));
// Alternative syntax:
birthdays["Susan"] = RWDate(30, "June", 1955);
birthdays["Gene"] = RWDate(5, "Jan", 1981);
// Print a birthday:
cout << birthdays["John"] << endl;
return 0;
}
Program Output:
04/12/75