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.

2123. merge() allocator requirements for lists versus forward lists

Section: 24.3.9.6 [forward.list.ops] Status: C++14 Submitter: Nicolai Josuttis Opened: 2012-01-15 Last modified: 2023-02-07

Priority: Not Prioritized

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

View all issues with C++14 status.

Discussion:

Sub-clause 24.3.10.5 [list.ops], p24 states for lists:

The behavior is undefined if this->get_allocator() != x.get_allocator().

But there is nothing like that for forward lists in [forwardlist.ops], although I would expect the same undefined behavior there.

[2012, Kona]

Move to Ready.

[2012, Portland: applied to WP]

Proposed resolution:

This wording is relative to the FDIS.

  1. Add a new paragraph after [forwardlist.ops] p19 as indicated:

    void merge(forward_list<T,Allocator>& x);
    void merge(forward_list<T,Allocator>&& x);
    template <class Compare> void merge(forward_list<T,Allocator>& x, Compare comp);
    template <class Compare> void merge(forward_list<T,Allocator>&& x, Compare comp);

    […]

    -19- Effects: […]

    -?- Remarks: The behavior is undefined if this->get_allocator() != x.get_allocator().