This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
Section: 99 [forwardlist.modifiers] Status: C++11 Submitter: Bo Persson Opened: 2009-11-25 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [forwardlist.modifiers].
View all issues with C++11 status.
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.
[ 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.
[ 2010-02-04 Nico provides wording. ]
[ 2010 Pittsburgh: ]
We prefer to return an iterator to the last inserted element. Modify the proposed wording and then set to Ready.
[ 2010-03-15 Howard adds: ]
Wording updated and set to Ready.
In forward_list modifiers 99 [forwardlist.modifiers] make the following modifications:
iterator insert_after(const_iterator position, size_type n, const T& x);
position.template <class InputIterator> iterator insert_after(const_iterator position, InputIterator first, InputIterator last);
position.iterator insert_after(const_iterator position, initializer_list<T> il);
position.template <class... Args> iterator emplace_after(const_iterator position, Args&&... args);