Boost logo

Boost Users :

Subject: [Boost-users] [bimap] How to erase a single association in a many-to-many bimap?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-05-15 06:09:13


Hi,

I have a bimap

typedef bimap<
     multiset_of< tagged< Person*, consultant> >,
     multiset_of< tagged< Company*, client> >,
     with_info< tagged< ConsultancyContract*, contract> >
> Consultancy;

initialized as follows

   Consultancy consultancy;
   Person John("John"), Jane("Jane");
   Company Dell("Dell"), HP("HP");
   ConsultancyContract JohnContractD(10,1);
   ConsultancyContract JaneContractD(20, 2);
   ConsultancyContract JaneContractH(30, 3);

   consultancy.insert(Consultancy::value_type(&Jane, &Dell,
&JaneContractD));
   consultancy.insert(Consultancy::value_type(&Jane, &HP, &JaneContractH));

and I want to remove only the specific association Jane<->Dell and so
I'm using

   consultancy.erase(Consultancy::value_type(&Jane, &Dell));

but then the resulting consultancy bimap is empty, while I expect the
association Jane<->HP to be there yet.

If I add before erasing
   consultancy.insert(Consultancy::value_type(&John, &Dell,
&JohnContractD));

and then
   consultancy.erase(Consultancy::value_type(&Jane, &Dell));

all the associations concerning Jane are removed.

What I'm doing wrong? How to erase a single association?

Best,
Vicente


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net