
2010/2/22 Andrew Kokkalis
Declaration of my container is below: struct counterpart { string word; int id; float tf_idf;
counterpart(string word_, int id_) {
Prefer an initializer list: counterpart(string word, int id) : word(word), id(id), tf_idf(0.0) {}
};
typedef multi_index_container< counterpart, indexed_by< ordered_unique< tag
, BOOST_MULTI_INDEX_MEMBER(counterpart, string, word)>, ordered_unique< tag , BOOST_MULTI_INDEX_MEMBER(counterpart, int, id)>, ordered_non_unique< tag , BOOST_MULTI_INDEX_MEMBER(counterpart, float, tf_idf)> > word_index;
word_index word_set;
Each index of word_index acts/behaves like the corresponding STL
container, and word_index "derives" from its first index so also
behaves like it.
So to search by word (first index), simply do a word_set.find() with a string.
To search by any index, first get a *reference* to that index, e.g.
word_set.get