Boost logo

Boost Users :

From: Lars Kunert (lkunert_at_[hidden])
Date: 2004-09-15 02:48:37


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<Value1, IndexSpecifierList1,
   Allocator1>::nth_index<0>::type&' from expression of type 'const
 
boost::multi_index::detail::ordered_index<boost::multi_index::const_mem_fun<NearestNeighborPair<uint>,
   float, &NearestNeighborPair<uint>::dissimilarity>, std::less<float>,
 
boost::multi_index::detail::ordered_index<boost::multi_index::const_mem_fun<NearestNeighborPair<uint>,
   uint, &NearestNeighborPair<uint>::object>, std::less<uint>,
 
boost::multi_index::detail::ordered_index<boost::multi_index::const_mem_fun<NearestNeighborPair<uint>,
   uint, &NearestNeighborPair<uint>::nearest_neighbor>, std::less<uint>,
   boost::multi_index::detail::index_base<NearestNeighborPair<uint>,
 
boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<boost::multi_index::tag<DissimilarityT,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
   boost::multi_index::const_mem_fun<NearestNeighborPair<uint>, float,
   &NearestNeighborPair<uint>::dissimilarity>,
   boost::multi_index::detail::null_arg>,
   boost::multi_index::ordered_unique<boost::multi_index::tag<ObjectT,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
   boost::multi_index::const_mem_fun<NearestNeighborPair<uint>, uint,
   &NearestNeighborPair<uint>::object>,
boost::multi_index::detail::null_arg>,
 
boost::multi_index::ordered_non_unique<boost::multi_index::tag<NearestNeighborT,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
   boost::multi_index::const_mem_fun<NearestNeighborPair<uint>, uint,
   &NearestNeighborPair<uint>::nearest_neighbor>,
   boost::multi_index::detail::null_arg>, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
   std::allocator<NearestNeighborPair<uint> > >,
   boost::multi_index::tag<NearestNeighborT, mpl_::na, mpl_::na, mpl_::na,

   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na>,
boost::multi_index::detail::ordered_non_unique_tag>,
   boost::multi_index::tag<ObjectT, mpl_::na, mpl_::na, mpl_::na,
mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na>, boost::multi_index::detail::ordered_unique_tag>,
   boost::multi_index::tag<DissimilarityT, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
   mpl_::na, mpl_::na>,
boost::multi_index::detail::ordered_non_unique_tag>'

The following typedef works:

 typedef typename
boost::multi_index::index<PriorityQueue,DissimilarityT>::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...

...I am using gcc 3.2.2

Thanks, Lars


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