我存储了一堆以下内容
struct Article {
std::string title;
unsigned db_id; // id field in MediaWiki database dump
};
Run Code Online (Sandbox Code Playgroud)
在Boost.MultiIndex容器中,定义为
typedef boost::multi_index_container<
Article,
indexed_by<
random_access<>,
hashed_unique<tag<by_db_id>,
member<Article, unsigned, &Article::db_id> >,
hashed_unique<tag<by_title>,
member<Article, std::string, &Article::title> >
>
> ArticleSet;
Run Code Online (Sandbox Code Playgroud)
现在我有两个迭代器,一个来自index<by_title>,一个来自index<by_id>.将这些索引转换为容器的随机访问部分的最简单方法是什么,而不添加数据成员struct Article?