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

### 2477. Inconsistency of wordings in `std::vector::erase()` and `std::deque::erase()`

**Section:** 24.3.8.4 [deque.modifiers], 24.3.11.5 [vector.modifiers] **Status:** C++17
**Submitter:** Anton Savin **Opened:** 2015-03-03 **Last modified:** 2017-07-30

**Priority: **0

**View all other** issues in [deque.modifiers].

**View all issues with** C++17 status.

**Discussion:**

In the latest draft N4296, and in all drafts up to at least N3337:

24.3.8.4 [deque.modifiers]/5 (regarding `deque::erase()`):

*Complexity*: The number of calls to the destructor is the same as the number of elements erased, but
the number of calls to the assignment operator is no more
than the lesser of the number of elements before the erased elements and the number of elements after the erased elements.

24.3.11.5 [vector.modifiers]/4 (regarding `vector::erase()`):

*Complexity*: The destructor of `T` is called the number of times equal to the number of the elements
erased, but the move assignment operator of `T` is called
the number of times equal to the number of elements in the vector after the erased elements.

Is there any reason for explicit mentioning of move assignment for `std::vector::erase()`?
Shouldn't these two wordings be the same with this regard?

Also, for `std::deque`, it's not clear from the text which destructors and assignment operators are called.

*[2015-05, Lenexa]*

Move to Immediate.

**Proposed resolution:**

This wording is relative to N4296.

Change 24.3.8.4 [deque.modifiers]/5 to:

-5- *Complexity*: The number of calls to the destructor of `T` is the same as the number of
elements erased, but the number of calls to the assignment operator of `T` is no more than the
lesser of the number of elements before the erased elements and the number of elements after the erased elements.

Change 24.3.11.5 [vector.modifiers]/4 to:

-4- *Complexity*: The destructor of `T` is called the number of times equal to the number of the elements
erased, but the ~~move~~ assignment operator of `T` is called the number of times equal to the number of
elements in the vector after the erased elements.