You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 24.6.9.1p6 [flat.map.overview] states: If any member function in 24.6.9.2 exits via an exception, the invariants are restored. [Note 2: This can result in the flat_map being emptied. — end note]
It is unclear how an adaptor can do this. For instance, if one of the underlying sequence containers is a std::array like type (possibly 3rd party) and the other is a std::vector like type (possibly 3rd party) and an exception is thrown during a move assignment, how does the implementation of flat_map restore the invariants? One cannot clear an array, and attempting to resize a vector may fail.
There is an identical issue with flat_multimap.
Proposed change:
Disallow array-like types as the underlying sequence containers (with the understanding that we could add them back in a future standard should this issue be worked out).
We can then require that clear() is called when an exception is thrown and that the post condition c.empty() holds for the underlying containers.