#include #include #include #include #include #include class Object{}; struct element { element(int x,int y,Object* pObject):x(x),y(y),pObject(pObject){} int x; int y; Object *pObject; }; struct offset_element { offset_element(int xoff,int yoff):xoff(xoff),yoff(yoff){} void operator()(element& e) { e.x+=xoff; e.y+=yoff; } int xoff,yoff; }; std::ostream& operator<<(std::ostream& out,const element& e) { return out<<"("< >, ordered_non_unique >, ordered_unique > > > container; void dump(const container& c) { std::copy( c.begin(),c.end(), std::ostream_iterator(std::cout,"\n")); std::cout<::type it1= c.get<1>().find(5); // ( 5, 5,&o4) c.get<1>().modify_key(it1,ll::_1=-5); // ( 5,-5,&o4) dump(c); container::iterator it3=c.find(20); // (20, 0,&o1) c.modify(it3,(&ll::_1)->*&element::y=10); // (20,10,&o1); dump(c); container::nth_index_iterator<2>::type it4= c.get<2>().find(&o2); // (10, 0,&o2) c.get<2>().modify(it4,offset_element(20,30)); // (30,30,&o2); dump(c); container::iterator it5=c.find(5); // ( 5,-5,&o4) element e=*it5; e.y=10; c.replace(it5,e); // ( 5,10,&o4); dump(c); }