
Hi Jeffrey
----- Mensaje original -----
De: Jeffrey Holle
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
>, ordered_non_unique< composite_key< entry, member , member > > > > C; C m_c; namespace ll=boost::lambda;
typedef nth_index
::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?