Created on 2009-11-25.00:00:00 last changed 161 months ago
Proposed resolution:
In forward_list modifiers [forwardlist.modifiers] make the following modifications:
iterator insert_after(const_iterator position, size_type n, const T& x);...
10 Returns:
position.An iterator pointing to the last inserted copy of x or position if n == 0.template <class InputIterator> iterator insert_after(const_iterator position, InputIterator first, InputIterator last);...
13 Returns:
position.An iterator pointing to the last inserted element or position if first == last.iterator insert_after(const_iterator position, initializer_list<T> il);...
15 Returns:
position.An iterator pointing to the last inserted element or position if il is empty.template <class... Args> iterator emplace_after(const_iterator position, Args&&... args);...
17 ...
Returns: An iterator pointing to the new constructed element from args.
[ 2010-03-15 Howard adds: ]
Wording updated and set to Ready.
[ 2010 Pittsburgh: ]
We prefer to return an iterator to the last inserted element. Modify the proposed wording and then set to Ready.
[ 2010-02-04 Nico provides wording. ]
[ 2010-02-04 Howard adds: ]
I agree this inconsistency will be error prone and needs to be fixed. Additionally emplace_after's return value is unspecified.
After applying LDR149, forward_list now has 5 overloads of insert_after, all returning an iterator.
However, two of those - inserting a single object - return "An iterator pointing to a copy of x [the inserted object]" while the other three - inserting zero or more objects - return an iterator equivalent to the position parameter, pointing before any possibly inserted objects.
Is this the intended change?
I don't really know what insert_after(position, empty_range) should really return, but always returning position seems less than useful.
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-08-23 20:07:26 | admin | set | status: wp -> c++11 |
2010-10-21 19:00:35 | admin | set | status: ready -> wp |
2010-10-21 18:28:33 | admin | set | messages: + msg1418 |
2010-10-21 18:28:33 | admin | set | messages: + msg1417 |
2010-10-21 18:28:33 | admin | set | messages: + msg1416 |
2010-10-21 18:28:33 | admin | set | messages: + msg1415 |
2010-10-21 18:28:33 | admin | set | messages: + msg1414 |
2009-11-25 00:00:00 | admin | create |