Boost logo

Boost Users :

Subject: Re: [Boost-users] [multi_index_container] Usage Idioms
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-09-15 07:27:12


On Mon, Sep 15, 2008 at 12:07 PM, <joaquin_at_[hidden]> 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.


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