Boost logo

Boost Users :

Subject: [Boost-users] trouble with correct type definition of multi_index::nth_index
From: Sandeep Gupta (gupta.sandeep_at_[hidden])
Date: 2009-03-22 14:29:57

 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.


///-------------------------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
      indexed_by <
                   ordered_unique<tuple_member_extractor<tuple_t,0> >
> tuplestore_t;

   tuplestore_t m_tuplestore;

  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;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at