Boost logo

Boost Users :

From: Oliver Kania (kania.oliver_at_[hidden])
Date: 2007-08-22 06:25:48


Hello Matias,
thank you for the solution.
1. Is the bimap method as efficient as using, for example,
the hashmap form the gnu-ext namespace ? ( I am talking about
time-efficiency)
2. Is a bimap serializeable by boost::serialize ? That would be absolutely
essential
3. I am sure that I read somewhere boost multi-index can be used as a mormal
hashmap
Did I misinterpret something ? i am asking because I know that multiindex is
serializeable.

regards, Oliver

On 8/21/07, Matias Capeletto <matias.capeletto_at_[hidden]> wrote:
>
> On 8/21/07, Oliver Kania <kania.oliver_at_[hidden]> wrote:
> > Hello,
>
> Hi Oliver,
>
> > what I basically want to do is using multi-index like a hashmap.
> > I want to use vector<long> as key. However, all the examples I found
> > are using member-fields of the values or the values themselves as key.
> > Is it not possible to use multi-index like a hash_map<value,key> where
> the
> > key is independent of the value type ?
> > If yes, could someone please provide an example ?
>
> You need Boost.Bimap. Online docs here: http://tinyurl.com/22sja5
> Look at "Unconstrained sets" section.
> It will be included in Boost 1.35, you can check out of svn head now.
>
> An example of what you are asking:
>
> typedef
> bimap
> <
> vector_of< long >,
> unconstrained_set_of< something >
> >
> bm_type;
>
> bm_type bm;
> assign::push_back( bm ) ( 1, a ) ( 2, b ) ( 3, c );
>
> BOOST_FOREACH( bm_type::left_reference p, bm.left )
> {
> cout << p.first << "-->" << p.second;
> }
>
> King regards
> Matias
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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