Boost logo

Boost :

From: Stefan Strasser (sstrasser_at_[hidden])
Date: 2005-05-02 16:20:56

Eric Niebler schrieb:
>> I think it's not worth it here.
>> besides that it isn't a performance overhead on most containers you
>> don't expect that from a keyword.
> Huh, *I* would expect that from a keyword.

can you explain that?
why do expect a keyword to create temporaries and use outdated values?

(and what are the semantics in other languages which have that keyword?)

>> std::string str="ab";
>> foreach(char c,str){
>> if(str.length() == 2) str+='c';
>> std::cerr << c << std::endl;
>> }
> See the discussion about iterator invalidation. This code has undefined
> behavior.

you're right
(even the SGI stl documentation admits that the std::string invalidation
rules are strange).

Stefan Strasser

Boost list run by bdawes at, gregod at, cpdaniel at, john at