Uthpal Urubail
I am looking for a container where I have to use 5-10 keys to get the value. I am trying to write something like below.. Can some one help to solve this?
struct entry { int a[10]; int id; };
[...]
typedef multi_index_container< entry, indexed_by< ordered_non_unique< composite_key< entry, member
[...]
Not sure if this is what you're looking for, but you can define
a global template function extracting the N-th component of
entry::a:
template<int N>
int get_a(const entry& e){return e.a[N];}
and then define composite_key on the ten elements of the array as follows:
composite_key<
entry,
global_fun
Is there any particular reason why you're packing the ten keys in an array 'a' rather than naming them like this? int a0,a1,a2,a3,a4,a5,a6,a7,a8,a9; It'd make thing easier wrt to declaring the composite_key. Joaquín M López Muñoz Telefónica