Boost logo

Boost Users :

Subject: Re: [Boost-users] Correct use of unordered_map
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2009-09-02 16:47:49


> Changing the order of the elements would invalidate iterators so it's
> safe to say that the order of elements that haven't been erased will
> remain the same. But be careful with other methods.
>
> > I might argue that even "successor" is not defined on this type.
>
> You might, but you probably shouldn't.
>
> Daniel

So the key would be a suitable definition for a "valid iterator". Each iterator for an "unordered" collection that nevertheless can proceed to end() is logically a state that contains a current element and a set of future to-be-traversed elements. Stepping will select one element from that remaining set, and produce an iterator with that as the current element and the future set reduced by that element. Erasing an element removes it from all outstanding iterator's future sets, if present. Inserting an element may or may not add it to the future set each outstanding iterator.

The future set is not "ordered" and any change might affect which element it picks next, compared to what it would have picked had you not done that. But that does not change the "validity".

The docs with Boost and with Microsoft's MSDN does not explain it properly. It's just copied from the regular map documentation, and saying it's "unordered" spoils the meaning of the copied phrasing.

Who might I talk to, concerning tightening up the Boost documentation or the ultimate C++ Standard documentation?

--John

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


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