
Dejan
That's right, but did you consider what I commented in my previous post?
Yeah, I did but the variable id is coming from outside (user) and not from inside (software). So p->id is never used.
The idea is to implement it the other way around, i.e. sorting by id: * When a user enters an id, you just look for it. * When the software has a pointer p to look for, it simply has to find(p->id) Clearer now?
[...]
But I have again a problem. I can't get the member variable (like id in this example) directly. I have to use get_id(). When defining:
typedef multi_index_container < employee*, indexed_by < ordered_unique
>, // next line does not work ordered_unique
> employee_set;
The code does not compile: error: ‘Employee::get_id() const’ cannot appear in a constant-expression error: a function call cannot appear in a constant-expression
You have to use const_mem_fun rather than member: http://www.boost.org/libs/multi_index/doc/tutorial/key_extraction.html#const... Joaquín M López Muñoz Telefónica, Investigación y Desarrollo