boostorg / unordered

Boost.org unordered module
http://boost.org/libs/unordered
Boost Software License 1.0
62 stars 55 forks source link

Documentation issue around iterator invalidation #240

Closed bgemmill closed 5 months ago

bgemmill commented 5 months ago

While unordered_node_map keeps valid pointer/references to keys, the iterators get invalidated on rehashing according to @joaquintides here

The documentation implies iterator stability: boost::unordered_node_map uses an open-addressing layout like boost::unordered_flat_map, but, being node-based, it provides pointer/iterator stability and node handling functionalities.

It may be worth repeating how iterators are invalidated within the standards compliance section for open addressing containers as well.

joaquintides commented 5 months ago

Hi, fixed in docs, thanks for the report.

It may be worth repeating how iterators are invalidated within the standards compliance section for open addressing containers as well.

I'm reluctant to add anything there because the section lists the differences with respect to standard unordered associative containers, and the standard is very clear that iterator stability is not provided:

https://eel.is/c++draft/unord.req.general#9

bgemmill commented 5 months ago

Thanks for closing this one out!