22.6 Setting Behavior Using Template Arguments
(cont.)
The collection is defined by the type it stores, and by the type
of its comparator
void f(OrderedCollection<Employee, CompareByName>& c)
{
. . .
}
OrderedCollection<Employee, CompareBySalary> a;
a.add(. . .);
OrderedCollection<Employee, CompareByName> b;
b.add(. . .);
f(a); // Errortypes don't match
f(b); // OK - type is OK