
15 Sep
2008
15 Sep
'08
11:27 a.m.
On Mon, Sep 15, 2008 at 12:07 PM, <joaquin@tid.es> wrote:
Robert Jones escribió:
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? [...]
Cannot you just resort to a manual for-loop like this?
multi_t mic; ... for(multi_t::iterator it=mic.begin(),it_end=mic.end();it!=it_end;){ if(pred(*it))it=mic.erase(it); else ++it; }
Yes, but that's also true for the erase-remove idiom in general. I was hoping there was something a bit more slick, ideally a one-liner. Thanks. - Rob.