trouble with correct type definition of multi_index::nth_index

Hi, In the following code I am trying to get an handle to the index of a multi_index container. The compiler says "invalid initialization of reference of type ‘boost::multi_index::detail:..". Not sure why this is so. Since I wasn't sure about the source of error I have pasted the full code ( sans declarations) is give below. Thanks sandeep ///-------------------------Full code --------------------- template<typename Col1_t, typename Col2_t, typename Col3_t, typename Col4_t> class TupleStore { typedef tuple<Col1_t, Col2_t, Col3_t, Col4_t> tuple_t; typedef multi_index_container < tuple_t, indexed_by < ordered_unique<tuple_member_extractor<tuple_t,0> > > > tuplestore_t; tuplestore_t m_tuplestore; public: template<int n> void lookup_key(Col1_t key) const { typedef typename tuplestore_t:: template nth_index<n>::type tuplestore_index_t; ///compiler error here tuplestore_index_t& indexx = m_tuplestore.get<n>(); } }; int main() { TupleStore<int,int,int,int> tstr; tstr.lookup_key<0>(5); }

Sandeep Gupta escribió:
Hi, In the following code I am trying to get an handle to the index of a multi_index container. The compiler says "invalid initialization of reference of type ‘boost::multi_index::detail:..". Not sure why this is so. Since I wasn't sure about the source of error I have pasted the full code ( sans declarations) is give below. [...]
tuplestore_index_t& indexx = m_tuplestore.get<n>();
Haven't looked in detail, but I think there's a missing 'template' keyword here: tuplestore_index_t& indexx = m_tuplestore.template get<n>(); Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (2)
-
joaquin@tid.es
-
Sandeep Gupta