
Hi Jeffrey ----- Mensaje original ----- De: Jeffrey Holle <jeffreyholle@bellsouth.net> Fecha: Lunes, Septiembre 24, 2007 11:08 pm Asunto: [Boost-users] [multi_index] modify problem with composite_key Para: Boost Users mailing list <boost-users@lists.boost.org>
I am having problems using the modify method with my composite_key. Here is my multi_index container definition: typedef multi_index_container< entry, indexed_by< ordered_unique<member<entry,DataVertex,&entry::m_vertex> >, ordered_non_unique< composite_key< entry, member<entry,int,&entry::m_y>, member<entry,int,&entry::m_x> > > > > C;
C m_c; namespace ll=boost::lambda;
typedef nth_index<C,1>::type XYINDEX;
I have a XYINDEX::iterator that is defined using the equal_range method of an XYINDEX order. Now I wish to modify the m_x attribute that this iterator points to so I attempt to write:
inline void Positioner::updateX(XYIterator iter,int x) { m_c.modify(iter,(&ll::_1)->*&Positioner::entry::m_x=x); }
I get this compiler error: [...]
m_c.modify(...) implicitly uses the interface of C's index #0, yet you're passing it a XYIterator, which belongs to index #1. Iterators have to be matched with the index they're associated with: inline void Positioner::updateX(XYIterator iter,int x) { // note the get<1>() bit m_c.get<1>().modify( iter,(&ll::_1)->*&Positioner::entry::m_x=x); } Does it work now? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo PS: I posted an answer to some previous question of yours that you haven't confirmed yet: http://lists.boost.org/boost-users/2007/09/30804.php Is it all solved?