I'm storing a bunch of the following
struct Article {
std::string title;
unsigned db_id; // id field in MediaWiki database dump
};
in a Boost.MultiIndex container, defined as
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;
Now I've got two iterators, one from index<by_title>
and one from index<by_id>
. What is the easiest way to transform these to indexes into the random access part of the container, without adding a data member to struct Article
?