4225. What should happen when an exception is thrown on resizing std::deque, std::forward_list, or std::list?

Section: 23.3.5.3 [deque.capacity], 23.3.7.5 [forward.list.modifiers], 23.3.11.3 [list.capacity] Status: New Submitter: Jiang An Opened: 2025-03-15 Last modified: 2025-03-15

Priority: Not Prioritized

View all other issues in [deque.capacity].

View all issues with New status.

Discussion:

Currently, std::vector and std::inplace_vector's resize functions are specified to have no effects on the container when an exception is throwing on appending. However, such specification seem to be missing for std::deque, std::forward_list, and std::list.

Is such difference intented? Do we want to roll back the status of container when the appending is partially done?

Daniel:

The specific resize exception guarantee for std::vector came from resolving LWG 2033 and were later effectively copied to std::inplace_vector because that container's specification should resemble as much as possible that of std::vector.

Proposed resolution: