Hi Joaquin, Supposing I have a container having three unique keys, Is there a way I can print data sorted by one of they keys? At the moment I tried a raw dump - it shows fields based on the first key (which is key1). Thanks Ramesh ---- typedef multi_index_container< MyMap, indexed_by< ordered_unique< tag <Key1>, BOOST_MULTI_INDEX_MEMBER(MyMap,std::string,Key1)>, ordered_non_unique< tag<Key2>,BOOST_MULTI_INDEX_MEMBER(MyMap,unsigned long,Key2)>, ordered_unique< tag<Key3>,BOOST_MULTI_INDEX_MEMBER(MyMap,unsigned long,Key3)> >
tMyMap;
class MyContainer { private: tMyMap MapObj; public: Show(){ for (MyMap::iterator it = MyContainer.begin(), itend = MyContainer.end(); it != itend;++it) { cout << it->Key1; cout << it->Key2; cout << it->Key3; } } }; main() { MyContainer M; // Assuming I have data inserted in the container like // ("Id 4", 10, 10) // ("Id 1", 10, 40) // ("Id 5", 30, 60) M.Show() // The result is as below: //("Id 5", 30, 60) // ("Id 1", 10, 40) // ("Id 4", 10, 10) }