boost::multi_index_container 由于索引 typedef 上的类型不完整而出现编译错误
我正在使用 boost::multi_index_container (如下所示),并且在尝试 typedef 索引时遇到编译错误:
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;
错误详细信息:
/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>'
尝试使用 typename
和 template
但我想我做得不对(因为我没有正确理解问题,无法正确解决它)。
任何帮助将不胜感激。
谢谢。
PS:我正在使用“g++(GCC)4.2.4(Ubuntu 4.2.4-1ubuntu4)”和“boost-1.42”。
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'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您可能缺少所需的包含,可能是
ordered_unique::nth_index
。It looks like you may be missing a needed include, possibly for
ordered_unique::nth_index
.