Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Key Types

In an stl map map<K,D> the first parameter type of the map template K is called key_type. It allows to select key-value pairs pairs via find(const K&) and to remove key-value pairs using erase(const K&). For icl Maps we have generalized key types to a larger set of types. Not only the key_type (domain_type) but also an interval type and a set type can be key types, that allow for selection and removal of map elements segments and submaps.

Table 1.16. Selection of elements, segments and sub maps using key types

M: interval_maps

m: icl_map

e: domain_type

key value pair

key value pair

i: interval_type

interval value pair

S: interval_sets

interval map

s: std::set

interval map


Subtraction, erasure, intersection

and containedness predicates can be used with those kinds of key types. For instance, the overload table for intersection

// overload tables for
T& operator &= (T&, const P&)

element containers:     interval containers:  
&= | e b s m            &= | e i b p S M    
---+--------            ---+------------    
s  | s   s              S  | S S     S       
m  | m m m m            M  | M M M M M M    

has a part that that allows for selection by key objects

element containers:     interval containers:  
&= | e b s m            &= | e i b p S M    
---+--------            ---+------------    
s  | s   s              S  | S S     S       
m  | m   m              M  | M M     M      

and another part that provides overloads for generalized intersection:

element containers:     interval containers:  
&= | e b s m            &= | e i b p S M    
---+--------            ---+------------    
s  | s   s              S  | S S     S       
m  |   m   m            M  |     M M   M      

For Sets, the key types defined for maps are identical with the set types themselves. So the distinction between the function groups selection by key and generalized intersection fall together in the well known set intersection.


PrevUpHomeNext