| Home | Libraries | People | FAQ | More

### 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 >

- Left type: `Type`
- Left collection type: `set_of< Type >`
- Left tag: `member_at::left`

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

- Left type: `Type`
- Left collection type: `{CollectionType}_of< LeftType >`
- Left tag: `member_at::left`

    bimap< tagged< Type, Tag >, R >

- Left type: `Type`
- Left collection type: `set_of< LeftType >`
- Left tag: `Tag`

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

- Left type: `Type`
- Left collection type: `{CollectionType}_of< LeftType >`
- Left tag: `Tag`

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 >

- set_of_relation_type: based on the left key type
- info: no info
- allocator: std::allocator

    bimap< L, R ,SetOfRelationType>

- set_of_relation_type: SetOfRelationType
- info: no info
- allocator: std::allocator

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

- set_of_relation_type: SetOfRelationType
- info: Info
- allocator: std::allocator

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

- set_of_relation_type: SetOfRelationType
- info: Info
- allocator: Allocator

    bimap< L, R , SetOfRelationType, Allocator>

- set_of_relation_type: SetOfRelationType
- info: no info
- allocator: Allocator

    bimap< L, R , with_info<Info> >

- set_of_relation_type: based on the left key type
- info: Info
- allocator: std::allocator

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

- set_of_relation_type: based on the left key type
- allocator: Allocator

    bimap< L, R , Allocator>

- set_of_relation_type: based on the left key type
- info: no info
- allocator: Allocator