
Hi all, I have following kind of class and having some identifier and group id associated with particular procedure. I want to know if I have to get the procedures relating particular group for ex. (groupId == 1). How do I do using multiindex container? Can somebody please give me some hint or code if they have done something similar to what I want to do? Thanks a lot, Priyank // class procedure test class Procedure { public: Procedure(int _id, int _group ) : id_(_id), group_(_group) { } int get_id() const { return id_; } int get_group() const { return group_; } friend ostream& operator << (ostream& _os, const Procedure& _proc); private: int id_; int group_; }; ostream& operator << (ostream& _os, const Procedure& _proc) { _os << "PROCEDURE : " << _proc.id_ << endl; return _os; } // Defines multiindex container that is hashed based on id struct id { }; typedef multi_index_container< Procedure*, indexed_by< hashed_unique< tag<id>, const_mem_fun<Procedure, int, &Procedure::get_id> >
Procedure_Hashed_Pool;
typedef Procedure_Hashed_Pool::index<id>::type Procedure_By_Id;