Title
forward_list::merge and forward_list::splice_after with unequal allocators
Status
c++14
Section
[forward.list.ops]
Submitter
Pablo Halpern

Created on 2011-03-24.00:00:00 last changed 123 months ago

Messages

Date: 2011-08-16.23:35:18

Proposed resolution:

This wording is relative to the FDIS.

  1. In [forwardlist.ops] p. 1 change as indicated:

    void splice_after(const_iterator position, forward_list<T,Allocator>& x);
    void splice_after(const_iterator position, forward_list<T,Allocator>&& x);
    

    1 - Requires: position is before_begin() or is a dereferenceable iterator in the range [begin(),end()). get_allocator() == x.get_allocator(). &x != this.

  2. In [forwardlist.ops] p. 5 change as indicated:

    void splice_after(const_iterator position, forward_list<T,Allocator>& x, const_iterator i);
    void splice_after(const_iterator position, forward_list<T,Allocator>&& 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().

  3. In [forwardlist.ops] p. 9 change as indicated:

    void splice_after(const_iterator position, forward_list<T,Allocator>& x, 
                      const_iterator first, const_iterator last);
    void splice_after(const_iterator position, forward_list<T,Allocator>&& x, 
                      const_iterator first, const_iterator last);
    

    9 - Requires: position is before_begin() or is a dereferenceable iterator in the range [begin(),end()). (first,last) is a valid range in x, and all iterators in the range (first,last) are dereferenceable. position is not an iterator in the range (first,last). get_allocator() == x.get_allocator().

  4. In [forwardlist.ops] p. 18 change 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);
    

    18 - Requires: comp defines a strict weak ordering ([alg.sorting]), and *this and x are both sorted according to this ordering. get_allocator() == x.get_allocator().

Date: 2011-08-16.23:35:18

[ 2011 Bloomington ]

Move to Ready.

Date: 2011-03-24.00:00:00

See also: 1215

list::merge and list::splice have the requirement that the two lists being merged or spliced must use the same allocator. Otherwise, moving list nodes from one container to the other would corrupt the data structure. The same requirement is needed for forward_list::merge and forward_list::splice_after.

History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2012-02-12 18:36:43adminsetstatus: voting -> wp
2012-02-09 04:07:48adminsetstatus: ready -> voting
2011-08-16 23:35:18adminsetmessages: + msg5852
2011-08-16 23:35:18adminsetstatus: new -> ready
2011-04-19 22:16:43adminsetmessages: + msg5719
2011-03-24 00:00:00admincreate