Created on 2012-10-31.00:00:00 last changed 131 months ago
Proposed resolution:
This wording is relative to N3376.
Edit [deque.cons] to remove everything after paragraph 10:
template <class InputIterator> void assign(InputIterator first, InputIterator last);
-11- Effects:erase(begin(), end()); insert(begin(), first, last);void assign(size_type n, const T& t);
-12- Effects:erase(begin(), end()); insert(begin(), n, t);
Edit [forwardlist.cons] to remove everything after paragraph 10:
template <class InputIterator> void assign(InputIterator first, InputIterator last);
-11- Effects: clear(); insert_after(before_begin(), first, last);void assign(size_type n, const T& t);
-12- Effects: clear(); insert_after(before_begin(), n, t);
Edit [list.cons] to remove everything after paragraph 10:
template <class InputIterator> void assign(InputIterator first, InputIterator last);
-11- Effects: Replaces the contents of the list with the range [first, last).void assign(size_type n, const T& t);
-12- Effects: Replaces the contents of the list with n copies of t.
Edit [vector.cons] to remove everything after paragraph 10:
template <class InputIterator> void assign(InputIterator first, InputIterator last);
-11- Effects:erase(begin(), end()); insert(begin(), first, last);void assign(size_type n, const T& t);
-12- Effects:erase(begin(), end()); insert(begin(), n, t);
[ 2013-04-20 Bristol ]
[ 2013-03-15 Issues Teleconference ]
Moved to Tentatively Ready.
DR 704 ensures allocator-aware containers can reuse existing elements during copy/move assignment, and sequence containers can do the same for assign().
But apart from std::list (which was changed by DR 320) the sequence containers define the Effects of assign() in terms of clear() followed by insert. A user-defined allocator can easily tell whether all old elements are cleared and then new elements inserted or whether existing elements are assigned to, so those Effects clauses cannot be ignored via the as-if rule. The descriptions of the assign() members for deque, forward_list and vector should be removed. Their intended effects are entirely described by the sequence container requirements table, and the specific definitions of them are worse than redundant, they're contradictory (if the operations are defined in terms of erase and insert then there's no need for elements to be assignable.) The descriptions of assign() for list are correct but redundant, so should be removed too.History | |||
---|---|---|---|
Date | User | Action | Args |
2014-02-20 13:20:35 | admin | set | status: wp -> c++14 |
2013-04-25 19:07:07 | admin | set | status: voting -> wp |
2013-04-19 22:36:19 | admin | set | messages: + msg6487 |
2013-04-19 22:36:19 | admin | set | status: ready -> voting |
2013-03-18 14:33:00 | admin | set | messages: + msg6424 |
2013-03-18 13:02:36 | admin | set | status: new -> ready |
2012-11-01 21:52:13 | admin | set | messages: + msg6231 |
2012-10-31 00:00:00 | admin | create |