Title
`hive::splice` can throw `bad_alloc`
Status
ready
Section
[hive.operations]
Submitter
Jonathan Wakely

Created on 2025-11-08.00:00:00 last changed 1 week ago

Messages

Date: 2025-12-04.17:38:09

Proposed resolution:

This wording is relative to N5014.

  1. Modify [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`.

Date: 2025-12-15.00:00:00

[ 2025-12-04; Reflector poll. ]

Set status to Tentatively Ready after seven votes in favour during reflector poll.

Date: 2025-11-08.00:00:00

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.

History
Date User Action Args
2025-12-04 17:38:09adminsetmessages: + msg15775
2025-12-04 17:38:09adminsetstatus: new -> ready
2025-11-08 02:11:21adminsetmessages: + msg15604
2025-11-08 00:00:00admincreate