
hi, now, I have two structures like this, struct peer { int guid_; }; struct channel { int md5_; peer* pr_; int prop_; }; ------------------------------------------ peer and channel is many to many. using example6::key_from_key class; ------------------------------------------ typedef multi_index_container< peer, index_by< ordered_unique< BOOST_MULTI_INDEX_MEMBER(peer, int, guid_) >
peer_table;
typedef multi_index_container< channel, index_by< ordered_non_unique< BOOST_MULTI_INDEX_MEMBER(channel, int, md5_) >
channel_table;
typedef multi_index_container< const channel*, ordered_non_unique< key_from_key< BOOST_MULTI_INDEX_MEMBER(peer, const int, guid_), BOOST_MULTI_INDEX_MEMBER(channel, const peer*, pr_) > >
channel_table_pr_view;
peer_table pt; channel_table ct; /// insert very much data.... nth_index<channel_table, 0>::type ic0,ic1; boost::tie(ic0, ic1) = get<0>(ct).equal_range(md5_); channel_table_pr_view ctpv; while (ic0 != ic1) { ctpv.insert(&*ic0); ++ic0; } channel_table_pr_view::iterator ictpv = ctpv.find(guid_); if (ictpv != ctpv.end()) { ctpv.modify(ictpv, _Modify_prop()); // right or not? } struct _Modify_prop{ void operator()(channel& cl_) { cl_.prop = rand(); } }; I want to modify channel' s prop. thanks. -- View this message in context: http://old.nabble.com/-multi_index--modify%7E%7E-tp29322711p29322711.html Sent from the Boost - Users mailing list archive at Nabble.com.