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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

The tutorial

Discovering the bimap framework
Interpreting bidirectional maps
Standard mapping framework
Bimap mapping framework
Controlling collection types
Freedom of choice
Configuration parameters
The collection of relations type
A new point of view
Configuration parameters
Differences with standard maps
operator[] and at()
Complexity of operations
Useful functions
Projection of iterators
replace and modify
Retrieval of ranges
Bimaps with user defined names
Unconstrained Sets
Additional information
Complete instantiation scheme
  1. Boost.Bimap is intuitive because it is based on the standard template library. New concepts are however presented to extend the standard maps to bidirectional maps. The first step is to gain a firm grasp of the bimap framework. The first section (Discovering the bimap framework) aims to explain this.
  2. Boost.Bimap offers much more than just a one-to-one ordered unique bidirectional map. It is possible to control the collection type of each side of the relationship that the bimap represents, giving one-to-many containers, hashed bidirectional containers and others that may be more suitable to the the task at hand. The second section (Controlling collection types) explains how to instantiate a bimap with different collection constraints.
  3. The section (The "collection of relations" type) explains how to create new types of bidirectional maps using custom collection types.
  4. In the section Differences with standard maps we will learn about the subtle differences between a bimap map view and a standard map.
  5. The section Useful functions provides information about functions of a bimap that are not found in the STL.
  6. The types of a bimap can be tagged so that each side is accessible by something closer to the problem than left and right. This leads to more readable, self-documenting code. The fourth section (Bimaps with user defined names) shows how to use this feature.
  7. The bimap mapping framework allows to disable a view of a bimap, including the standard mapping containers as a particular case. The section Unconstrained Sets explains how they work.
  8. The section Additional information explains how to attach information to each relation of a bimap.
  9. The final section (Complete Instantiation Scheme) summarizes bimap instantiation and explains how change the allocator type to be used.