|
Boost Users : |
Subject: [Boost-users] [multi_index_container] Usage Idioms
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-09-15 05:54:07
My head is now exploding with understanding the full power and flexibility of
multi-index-container, but still it is not clear to me how best to do the simple
things!
What is the idiomatically 'correct' way to apply the equivalent functionality
of the erase-remove idiom to a multi-index-container?
I'm assuming that this, (very much abridged for brevity of exposition)
multi_index_container mic;
mic.erase( remove_if( mic.begin(), mic.end(), pred ), mic.end() );
is doomed since the remove algorithms overwrite removed elements with
copied elements which would cause havoc with other indices, and in any
case this kind of modification through iterators is explicitly prohibited.
I did think of extracting a vector of references, doing erase-remove on
that and then applying rearrange(), but it seems rather inelegant. Is there
a better way?
Thanks.
- Rob.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net