0
我的代码(不是我写的)使用多索引容器。boost multi_multi索引的用法
typedef boost::multi_index_container<
Block*,
boost::multi_index::indexed_by<
boost::multi_index::random_access<>,
boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(Block,uint,pages_invalid) >
>
> active_set;
typedef active_set::nth_index<0>::type ActiveBySeq;
typedef active_set::nth_index<1>::type ActiveByCost;
active_set active_cost;
“块”是一类。
该容器被用作优先级队列。
ActiveByCost::iterator it = active_cost.get<1>().end();
--it;
我想搜索变量A ==“特定值”的成员。 (不适用于优先队列)
A是Class Block的成员变量之一。
有没有办法做到这一点?
是否“如果这个成员没有索引”意味着A不是数组? – WKK
@WKK这意味着'boost :: multi_index :: indexed_by <>'中没有该成员的索引。 –
@maxim_egorushkin谢谢。还有一个问题,我如何访问multi_index容器的位置数据? – WKK