Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-02-22 10:58:15


tal boost ha escrito:

> Hi,
>
> Please note that the first index works
> const hndl_index_type &h_type = boost::multi_index::get<hndl>(ns);
> NodePtrSet::const_iterator it = h_type.find(theHandle); //works
>
> but if I try to access the 2nd index doing:
> ...
> const group_index_type &g_type = boost::multi_index::get<group>(ns);
> NodePtrSet::iterator group_it = g_type.find(aGroup);
>
> I get the following output error:

[...]

Replace

NodePtrSet::iterator group_it = ...;

with

group_index_type::iterator it = ...;

NodePtrSet::iterator (which is the same as hndl_index_type::iterator
since hndl_index_type is index #0) is a different type than
group_index_type::iterator, which is associated to index #1.
You cannot freely mix iterators from different indices, though
if the necessity arises you can convert between them with project()
capabilities:

http://boost.org/libs/multi_index/doc/tutorial.html#projection

HTH,

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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk