This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4123. Container effects use "the assignment operator or move assignment operator"

Section: 24.3.9.4 [deque.modifiers], 24.3.12.5 [vector.modifiers], 24.3.14.5 [inplace.vector.modifiers] Status: New Submitter: Jonathan Wakely Opened: 2024-07-25 Last modified: 2024-08-02

Priority: 3

View other active issues in [deque.modifiers].

View all other issues in [deque.modifiers].

View all issues with New status.

Discussion:

The spec for deque::erase talks about a exception "thrown by the assignment operator of T" but it's unclear which assignment operator this means. Arguably, this is fine because it means "the assignment operator that is used when repositioning the remaining elements". However, deque::append_range, vector::append_range, vector::erase, inplace_vector::append_range, and inplace_vector::erase talk about "the assignment operator or move assignment operator" which is just odd. In C++03 this just said "the assignment operator" and move semantics added "or the move assignment operator" but we could improve it.

What we should talk about is "an assignment operator", or "the assignment operator selected by overload resolution for the assignment expressions performed by the operation", or something like that.

This is potentially a bigger issue than just assignment: for append_range we say "If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or move assignment operator [...]" and there's no guarantee that the constructor used for initializing a Cpp17CopyInsertable type is a copy constructor or move constructor. It could be some templated constructor that is a better match than any of the special member functions.

[2024-08-02; Reflector poll]

Set priority to 3 after reflector poll. Arthur to draft wording.

Proposed resolution: