multi_index - type problems

Hi!
for some reason these two typdefs do not work in my code:
typedef typename PriorityQueue::nth_index<0>::type DissimilarityIndex;
typedef typename PriorityQueue::index<DissimilarityT>::type
DissimilarityIndex;
When I actually use them:
const DissimilarityIndex& di =_priority_queue.get<DissimilarityT>();
I get error-messages like this:
../../../pocket_graph/src/clustering/NearestNeighbors.h:300: error:
invalid
initialization of reference of type 'typename
boost::multi_index::multi_index_container

Lars Kunert
Hi!
Hi Lars
for some reason these two typdefs do not work in my code:
typedef typename PriorityQueue::nth_index<0>::type DissimilarityIndex; typedef typename PriorityQueue::index<DissimilarityT>::type DissimilarityIndex;
PriorityQueue is a template parameter or a dependent type, right? Otherwise, you should omit the typename keyword.
When I actually use them:
const DissimilarityIndex& di =_priority_queue.get<DissimilarityT>();
I get error-messages like this:
[...]
The following typedef works:
typedef typename boost::multi_index::index
::type DissimilarityIndex; The first two typedefs are in some way the more "natural" way to use indices and I wonder if I have just missed to set some preprocessor symbol...
You are not missing anything. The three typedefs are equivalent and should work the same way. I agree with you the former variants are preferrable over the third.
...I am using gcc 3.2.2
Maybe that's the problem. GCC 3.2.2 is at the bottom of what is supported by Boost.MultiIndex. If this is feasible, you might try upgrading your compiler. Also, if you are in the position to send me some failing snippet that I can examine, I'd be happy to do so, but my feeling is that the problem does not have to do with your code. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (2)
-
Joaquin M Lopez Munoz
-
Lars Kunert