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

4467. hive::splice can throw bad_alloc

Section: 23.3.9.5 [hive.operations] Status: New Submitter: Jonathan Wakely Opened: 2025-11-07 Last modified: 2025-11-08

Priority: Not Prioritized

View other active issues in [hive.operations].

View all other issues in [hive.operations].

View all issues with New status.

Discussion:

Moving blocks from the source hive to the destination hive might require reallocating the array of pointers to blocks, so the Throws: element should allow this.

Proposed resolution:

This wording is relative to N5014.

  1. Modify 23.3.9.5 [hive.operations], as indicated:

    void splice(hive& x);
    void splice(hive&& x);
    

    -2- Preconditions: get_allocator() == x.get_allocator() is true.

    -3- Effects: If addressof(x) == this is true, the behavior is erroneous and there are no effects. Otherwise, inserts the contents of x into *this and x becomes empty. Pointers and references to the moved elements of x now refer to those same elements but as members of *this. Iterators referring to the moved elements continue to refer to their elements, but they now behave as iterators into *this, not into x.

    -4- Throws: length_error if any of x's active blocks are not within the bounds of current-limits , as well as any exceptions thrown by the allocator.

    -5- Complexity: Linear in the sum of all element blocks in x plus all element blocks in *this.

    -6- Remarks: Reserved blocks in x are not transferred into *this. If addressof(x) == this is false, invalidates the past-the-end iterator for both x and *this.