I have a struct
struct employee
{
int id;
std::string name;
employee(int id,const std::string& name):id(id),name(name){}
bool operator<(const employee& e)const{return id<e.id;}
getId(){return id;}
getName(){return name;}
};
If I make boost multi index like this from tutorial everything works well
typedef multi_index_container<
employee,
indexed_by<
// sort by employee::operator<
ordered_unique<identity<employee> >,
// sort by less<string> on name
ordered_non_unique<member<employee,std::string,&employee::name> >
>
> employee_set;
But if I make members of employee struct private, then I lose ability to use em as keys for container. I tried put pointers to getter functions like this &emploeyy::getName
but it did not solver the problem.
So my question is: how to use private members as keys for multi index container?