cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

US 41-102 24.6.9 [flat.map], 24.6.10 [flat.multimap] Moved-from state #518

Closed wg21bot closed 1 year ago

wg21bot commented 1 year ago

Because flat_map and flat_multimap maintain an invariant over the containers they own, the implicitly generated move constructor and move assignment operator are not sufficient to guarantee that the moved-from flat_map and flat_multimap is in a valid but unspecified state.

Proposed change:

Spell out the operations that are allowed on a moved-from flat_map and flat_multimap and require that the underlying containers also support those operations in their moved-from state as well.

Those operations should be destruction, copy construction, move construction, copy assignment and move assignment.

The following should be valid code:

void A(vector<flat_map<KeyContainer, MappedContainer>& v) {
    assert(!v.empty());
    auto fm = std::move(v.front());
    v.resize(v.capacity() + 1); 
}
JeffGarland commented 1 year ago

LWG review 2022-11-07 and found no consensus for change. Unanimous consent from the room.

https://wiki.edg.com/bin/view/Wg21kona2022/LWG20221107-EA

jensmaurer commented 1 year ago

Rejected. There is no consensus for a change.