$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [multi_index_container] Usage Idioms
From: joaquin_at_[hidden]
Date: 2008-09-15 08:29:35
Daniel Krügler escribió:
> joaquin_at_[hidden] wrote:
>
>> 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;
>> }
>>
>
> Btw.: Is this a documented feature that end() will not be invalidated
> by erase? Sorry, if this is a beginner's question, but I could not find
> such a statement in the docs (probably too blind).
>
Yes, see for instance in the case of ordered indices at
http://tinyurl.com/5g5kd6 :
"Except where noted, ordered indices [...] are models of Sorted
Associative Container and
Unique Associative Container, much as std::sets are. Accordingly,
validity of iterators and
references to elements is preserved."
Similar statements are made for the rest of index types.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo