Boost logo

Boost :

From: Matias Capeletto (matias.capeletto_at_[hidden])
Date: 2007-02-23 07:57:32

On 2/23/07, Jose <jmalv04_at_[hidden]> wrote:
> Hi,
> Boost.Bimap provides a simple translation example and I was wondering
> whether the library can
> be used for the general case of many to many relationships, i.e.
> Hola --< Hello
> Hola --< Hi
> Interesante >-- Cool
> Frio >-- Cool
> so that I basically can have two multimaps coupled together rather than
> having to
> build them separately

Hi Jose,
Yes, Boost.Bimap provides a one-to-one mapping as it default. (bimap<X,Y>)
But the library is a framework for bidirectional mapping, and your
request is included in it. I recommend you to read the library
tutorial where it is explained how to control the constraints of the
Basically you have to think that you are mapping two set types.
For example:

bimap<X,Y> is the same as bimap< set_of<X>, set_of<Y> >

The container you are looking for will be a

bimap< multiset_of<std::string>, multiset_of<std::string> >

I encourage you to read the first pages of the tutorial.
Best regards

Boost list run by bdawes at, gregod at, cpdaniel at, john at