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

Complete instantiation scheme

To summarize, this is the complete instantiation scheme.

typedef bimap
<
    LeftCollectionType, RightCollectionType

    [ , SetTypeOfRelation  ]  // Default to left_based
    [ , with_info< Info >  ]  // Default to no info
    [ , Allocator          ]  // Default to std::allocator<>

> bm;

{Side}CollectionType can directly be a type. This defaults to set_of<Type>, or can be a {CollectionType}_of<Type> specification. Additionally, the type of this two parameters can be tagged to specify user defined names instead of the usual member_at::-Side- tags.

The possibles way to use the first parameter are:

bimap< Type, R >
bimap< {CollectionType}_of< Type >, R >
bimap< tagged< Type, Tag >, R >
bimap< {CollectionType}_of< tagged< Type, Tag > >, R >

The same options are available for the second parameter.

The last three parameters are used to specify the collection type of the relation, the information member and the allocator type.

If you want to specify a custom allocator type while relying on the default value of CollectionTypeOfRelation, you can do so by simply writing bimap<LeftKeyType, RightKeyType, Allocator>. Boost.Bimap's internal machinery detects that the third parameter in this case does not refer to the relation type but rather to an allocator.

The following are the possible ways of instantiating the last three parameters of a bimap. You can ignore some of the parameter but the order must be respected.

bimap< L, R >
bimap< L, R ,SetOfRelationType>
bimap< L, R , SetOfRelationType, with_info<Info> >
bimap< L, R , SetOfRelationType, with_info<Info>, Allocator>
bimap< L, R , SetOfRelationType, Allocator>
bimap< L, R , with_info<Info> >
bimap< L, R , with_info<Info>, Allocator>
bimap< L, R , Allocator>

PrevUpHomeNext