79551672

Date: 2025-04-02 22:19:12
Score: 0.5
Natty:
Report link

This is not yet definitive. But so far it appears the consensus answer is that this isn't possible.

I believe the text of

https://cplusplus.github.io/LWG/issue2356

acknowledges the need for a container object to be traversable, while deleting parts of it which is why the particular requirements on 'erase'. However, the complete lack of ANY guarantees about iteration ordering (no matter how you work at it) for unordered_map (and unordered cousins) - makes them unsuitable libraries if you wish to use COW (copy-on-write) - because containers might need to 'copy' their data while an iteration is proceeding.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
Posted by: lewis