Short Tutorial

Following is a short tutorial introducing the main points of pb_assoc. It is organized as follows.

  1. Basic Use of Maps

Basic Use of Maps

For the greater part, using pb_assoc's maps is similar to using those of the STL. For example, the following shows a collision-chaining container mapping integers to characters.

cc_hash_assoc_cntnr<int, char> c;

c[2] = 'b';

assert(c.find(1) == c.end());

Inteface::Containers describes the containers supported. basic_map_example.cpp shows an example.

Other Mapping Semantics

pb_assoc does not contain separate containers for different mapping semantics, as the STL does (e.g., std::map and std::multimap). Rather, containers are parameterized by a Data parameter, and this parameter is a policy for the mapping semantics.

Instantiating the Data parameter by null_data_type makes a "set". For example, the following shows a collision-chaining container storing integers.

cc_hash_assoc_cntnr<int, null_data_type> c;

c.insert(2);

assert(c.find(1) == c.end());