1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
The associative containers offered by bf(C++) allow us to find a value (or
values) matching a given key. Traditionally, the type of the key used for the
lookup must match the container's key type.
Since the C++14 standard arbitrary lookup key types can be used provided a
comparison operator is available to compare that type with the container's key
type. Thus, a tt(char const *) key (or any other type for which an
tt(operator<) overload for tt(std::string) is available) can be used to lookup
values in a tt(map<std::string, ValueType>). This is called
emi(heterogeneous lookup).
Heterogeneous lookup is allowed when the comparator given to the associative
container does allow this. The standard library classes tt(std::less) and
tt(std::greater) were augmented to allow heterogeneous lookup.
|