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

2222. Inconsistency in description of forward_list::splice_after single-element overload

Section: 24.3.9.6 [forward.list.ops] Status: C++14 Submitter: Edward Catmur Opened: 2012-12-11 Last modified: 2023-02-07

Priority: Not Prioritized

View all other issues in [forward.list.ops].

View all issues with C++14 status.

Discussion:

[forwardlist.ops] p6 has

void splice_after(const_iterator position, forward_list& x, const_iterator i);
void splice_after(const_iterator position, forward_list&& x, const_iterator i);

Effects: Inserts the element following i into *this, following position, and removes it from x. The result is unchanged if position == i or position == ++i. Pointers and references to *i continue to refer to the same element but as a member of *this. Iterators to *i (including i itself) continue to refer to the same element, but now behave as iterators into *this, not into x.

This overload splices the element following i from x to *this, so the language in the two latter sentences should refer to ++i:

Pointers and references to *++i continue to refer to the same element but as a member of *this. Iterators to *++i continue to refer to the same element, but now behave as iterators into *this, not into x.

[2013-03-15 Issues Teleconference]

Moved to Tentatively Ready.

[2013-04-20 Bristol]

Proposed resolution:

This wording is relative to N3485.

  1. Edit [forwardlist.ops] p6 as indicated:

    void splice_after(const_iterator position, forward_list& x, const_iterator i);
    void splice_after(const_iterator position, forward_list&& x, const_iterator i);
    

    -5- Requires: position is before_begin() or is a dereferenceable iterator in the range [begin(),end()). The iterator following i is a dereferenceable iterator in x. get_allocator() == x.get_allocator().

    -6- Effects: Inserts the element following i into *this, following position, and removes it from x. The result is unchanged if position == i or position == ++i. Pointers and references to *++i continue to refer to the same element but as a member of *this. Iterators to *++i (including i itself) continue to refer to the same element, but now behave as iterators into *this, not into x.