Re: [boost] Is there a one-to-one map class in boost?

On 7/17/06, Felipe Magno de Almeida <felipe.m.almeida@gmail.com> wrote:
On 7/17/06, Wang Weiwei <wwwang@ccsdl.org> wrote:
Hello,
Now I'm finding a one-to-one map class, say map1, that support the following syntax:
map1 m;
m.insert(std::make_pair(k1, v1)); ... key k; value v;
v = m[k]; k = m[v];
I know a pair of std::map could provide such functionality. But I think a single obj, if that class exists, would be more elegant.
Is there such a class in boost?
Look for multi_index library. There are examples of such usage.
I am doing a bidirectional map as one of the boost SoC projects (The class you are looking for is a particular case of it). Basically it is a stl map like wrapper around Boost.MultiIndex. I will present a first release to the list as soon as possible. I invite you to participate in the discussion that will surely follows. Just give me a few more days :)
Another good news! Of course I could struggle to use a pair of class as a temp/ugly solution, and with in mind that a perfert solution is waiting for me. A few days is not a long time. :-) Thanks in advance.
Best Regards Matias Capeletto

Meanwhile you can have a look at the bidirectional map implementation using B.MI here: http://www.boost.org/libs/multi_index/example/bimap.cpp SeskaPeel -----Message d'origine----- De : boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] De la part de Wang Weiwei Envoyé : mardi 18 juillet 2006 04:32 À : boost@lists.boost.org Objet : Re: [boost] Is there a one-to-one map class in boost?
On 7/17/06, Felipe Magno de Almeida <felipe.m.almeida@gmail.com> wrote:
On 7/17/06, Wang Weiwei <wwwang@ccsdl.org> wrote:
Hello,
Now I'm finding a one-to-one map class, say map1, that support the following syntax:
map1 m;
m.insert(std::make_pair(k1, v1)); ... key k; value v;
v = m[k]; k = m[v];
I know a pair of std::map could provide such functionality. But I think a single obj, if that class exists, would be more elegant.
Is there such a class in boost?
Look for multi_index library. There are examples of such usage.
I am doing a bidirectional map as one of the boost SoC projects (The class you are looking for is a particular case of it). Basically it is a stl map like wrapper around Boost.MultiIndex. I will present a first release to the list as soon as possible. I invite you to participate in the discussion that will surely follows. Just give me a few more days :)
Another good news! Of course I could struggle to use a pair of class as a temp/ugly solution, and with in mind that a perfert solution is waiting for me. A few days is not a long time. :-) Thanks in advance.
Best Regards Matias Capeletto
participants (2)
-
SeskaPeel
-
Wang Weiwei