BloombergLP::bslalg::BidirectionalLinkListUtil::spliceListBeforeTarget

Splice the range [first, last] into another list before target.

Synopsis

Declared in <bslalg_bidirectionallinklistutil.h>

static
void
spliceListBeforeTarget(
    BidirectionalLink* first,
    BidirectionalLink* last,
    BidirectionalLink* target);

Description

Unlink and move (splice) the elements of a doubly-linked list included in the closed range [first, last] out of their original list and into another doubly-linked list before the specified target node. If target is 0, then the elements are extracted and form a new list such that 0 == first->previousLink() and 0 == last->nextLink(). After successful execution of this function the values of the previousLink and nextLink attributes of all the links in the origin and destination lists appropriately reflect the operation. The behavior is undefined unless both first and last are non-zero members of the same linked list; first precedes last in the list, or first == last; target is not a node contained in the closed range [first, last]; and isWellFormed(first, last) is true.

Parameters

NameDescription
firstfirst node of the closed range to splice
lastlast node of the closed range to splice
targetnode before which the range is inserted, or 0