Boost logo

Boost Users :

Subject: Re: [Boost-users] multi index container
From: Dejan (xamiw_at_[hidden])
Date: 2010-02-03 10:39:29


>
> >
>
> (I guess you meant e3 in the line above.)
Yes, my fault.
>
> > Can someone tell me how a typedef of a multi_index_container fullfilling
> > prerequisities above looks?
>
> The following would do:
>
> typedef multi_index_container<
> employee*,
> indexed_by<
> ordered_unique<
> member<employee,int,&employee::id>
> >
> >
> > multi_t;
>
> The lib is smart enough that can index by employee::id even if what you
> store are
> not employees proper, but pointers to employee.
Ahh, ok.
>
> > Or is a multi_index_container not the right
> > tool?
> >
>
> Using Boost.MultiIndex might be overkill here if this is all you need
> from it:
> an std::set can be used also with a suitable compare predicate.
I don't know if finding pointer OR id is possible in a std::set. I've
tried a std::set with a compare class (which compares pointer and id).
To store is not a problem but to "container.find(pointer)" AND
"container.find(id)".

Thanks


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