Hi,
Say i have two sets of data with same search condition, but one set needs a MRU(Most Recently Used) list of 100 and the other set requires a MRU of 200. Say the entry is like this
class Student
{
int student_no;
char sex;
std::string address;
};
The search criteria is student_no, but for sex='m', we need MRU of 200 and for sex='f', we need a MRU of 100. Now i have a solution where in i introduce a new ordered index to maintain ordering.
For example the IndexSpecifierList will be something like this
typedef multi_index_container<
Student,
indexed_by<
ordered_unique< member<Student, int, &Student::student_no> >,
ordered_unique< composite_key<
member<Student, char, &Student::sex>,
member<Student, int, &Student::sex_specific_student_counter> > >
>
> student_set
Here i have to introduce a new counter called sex_specific_student_counter, and during the eviction time, i need a logn search. Insertion also involves a extra logn complexity. Now instead if i have two sequenced indexes (like mentioned in the MRU example) in the place of second ordered index, but both with a condition on indexing only a few items, this would have looked more elegant and with better performance.
Thanks in advance,
Gokul.