c++boostboost-multi-index

boost::multi_index_container compile error due to incomplete type on index typedef'ing


I am using the boost::multi_index_container (as follows) and I am running into a compile error when trying to typedef the index:

struct del_t
{
  string del_id;
  string dev_version;
};

struct count_container_t
{
  uint32_t count_1;
  uint32_t count_2;
};

struct mic_t
{
  del_t d;
  uint32_t p;
  string c;
  map<uint32_t, count_container_t> b;
};

typedef multi_index_container
<mic_t,

 indexed_by
 <ordered_unique<member<mic_t,
                        del_t,
                        &mic_t::d>
                 >
  >
 > super_mic_t;

//The following line is causing the compile error. Compiles fine without it.
typedef super_mic_t::nth_index<0>::type zeroth_index_t; 

Error details:

/usr/include/boost/multi_index/detail/base_type.hpp:54: error: invalid use 
of incomplete type 'struct 
boost::multi_index::ordered_unique<boost::multi_index::member<mic_t, 
del_t, &mic_t::d>, mpl_::na, mpl_::na>'

Tried variants of using typename and template but I guess I am not doing it right (as I haven't understood the problem correctly, to be able to solve it correctly).

Any help would be most appreciated.

Thanks.

PS: I am using 'g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)' and 'boost-1.42'.


Solution

  • It looks like you may be missing a needed include, possibly for ordered_unique::nth_index.