Algorithm 多索引中的多个唯一键
我正在尝试将对象存储在Algorithm 多索引中的多个唯一键,algorithm,stl,boost-multi-index,Algorithm,Stl,Boost Multi Index,我正在尝试将对象存储在boost多索引容器中 这些对象都是唯一的,可以通过两个单独的键(也唯一)检索 但是它没有编译,我得到了以下错误 error: invalid conversion from ‘int’ to ‘const char*’ 当我对字符串使用相同的代码时,效果很好;你知道我做错了什么吗?auto-it=cntr\uu.get().find(id); auto it = cntr_.get<1>().find(id); 每个索引都可以单独访问(通过get),并且
boost多索引
容器中
这些对象都是唯一的,可以通过两个单独的键(也唯一)检索
但是它没有编译,我得到了以下错误
error: invalid conversion from ‘int’ to ‘const char*’
当我对字符串使用相同的代码时,效果很好;你知道我做错了什么吗?auto-it=cntr\uu.get().find(id);
auto it = cntr_.get<1>().find(id);
每个索引都可以单独访问(通过
get
),并且有自己的成员函数、迭代器等(如果您不能使用auto
,它属于Cntr::nth\u index::type::iterator
)有关文档的更多信息。Hi!刚刚注意到你是创造自由的人!!!啊!!不错的东西,写的代码少了好几行很高兴知道它有用:-)
error: invalid conversion from ‘int’ to ‘const char*’
auto it = cntr_.get<1>().find(id);