Boost Users :
Subject: Re: [Boost-users] multi-index-container with nested templates => problem getting iterator on 2nd index.
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2009-05-13 16:38:00
JohnQ <jqs <at> jqs.net> writes:
> Hi,Â I'm really stuck on this one, so I'm hoping someone can lend me a hand.
>Â Basically, I'm defining a templated multi-index-container to hold one piece
> of data along with two indexes to that data.Â Next, I'm wrapping that in
> another templated class that will handle concurrent access to that structure.
> My problem is that I'm having trouble figuring out how to define a type
> that will give me an interator on the 2nd index of the multi-index-container
> ("bimimapIterator2" below).
> Â Â typedef boost::multi_index_container<
> Â Â Â value_type,
> Â Â Â indexed_by<
> Â Â Â Â ordered_non_unique<
> Â Â Â Â Â tag<index1>,member<value_type,Key1,&value_type::first> >,
This cannot possibly work, as value_type does not have a
member called first (you're using a tuple, not an std::pair).
Anyway, the problem does not lie here.
> typedef typename bimultimap<Key1,Key2,Data>::
> bimimap::index<index2>::type::iterator bimimapIterator2;
You need a disambiguating template keyword:
typedef typename bimultimap<Key1,Key2,Data>::
bimimap::template index<index2>::type::iterator bimimapIterator2;
Hope this helps. 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