Boost logo

Boost Users :

Subject: Re: [Boost-users] [MultiIndex] Iterator validity when modifying equal_range keys
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2011-09-03 05:18:25


Ovanes Markarian <om_boost <at> keywallet.com> writes:

>
> On Fri, Sep 2, 2011 at 9:25 PM, Joaquin M Lopez Munoz
> <joaquin <at> tid.es> wrote:
> >
> > Ovanes Markarian <om_boost <at> keywallet.com> writes:
> > >
> > >   entry_data& entries = indexed; //get the view to the MI-Container
> >
> > What is this supposed to do? Usually you get an index view
> > using get(), which you're not using here. 
>
> I thought I am getting an index view here. Isn't it done implicitly...
> Why am I suppose to use it than?
> The upper statement can be seen as:
>
>
> my_index_container_type::index<named_tag>::type& entries = indexed;
>
> If I am not suppose to do that this way, why does this code compile?
> I know the docs state I should use the
>
> my_index_container_type::get<...> member, by how is this construct
> should be different?

In this particular case you're being lucky because the index you're
getting is the first one and the whole multi_index_container publicly
derives from it. If you tried a different index it wouldn't have
worked. In general you shouldn't rely on this trick not even for
index #0.
 Â 
> Ok thanks for your help and a great lib! 

Thanks for using Boost.MultiIndex.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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