[#BloombergLP-bslalg-BidirectionalLinkListUtil-spliceListBeforeTarget]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/BidirectionalLinkListUtil.adoc[BidirectionalLinkListUtil]::spliceListBeforeTarget
:relfileprefix: ../../../
:mrdocs:

Splice the range `&lsqb;first, last&rsqb;` into another list before `target`&period;

== Synopsis

Declared in `&lt;bslalg&lowbar;bidirectionallinklistutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void
spliceListBeforeTarget(
    xref:BloombergLP/bslalg/BidirectionalLink.adoc[BidirectionalLink]* first,
    xref:BloombergLP/bslalg/BidirectionalLink.adoc[BidirectionalLink]* last,
    xref:BloombergLP/bslalg/BidirectionalLink.adoc[BidirectionalLink]* target);
----

== Description

Unlink and move (splice) the elements of a doubly&hyphen;linked list included in the closed range `&lsqb;first, last&rsqb;` out of their original list and into another doubly&hyphen;linked list before the specified `target` node&period; If `target` is 0, then the elements are extracted and form a new list such that `0 &equals;&equals; first&hyphen;&gt;previousLink()` and `0 &equals;&equals; last&hyphen;&gt;nextLink()`&period; 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&period; The behavior is undefined unless both `first` and `last` are non&hyphen;zero members of the same linked list&semi; `first` precedes `last` in the list, or `first &equals;&equals; last`&semi; `target` is not a node contained in the closed range `&lsqb;first, last&rsqb;`&semi; and `isWellFormed(first, last)` is true&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *first*
| first node of the closed range to splice
| *last*
| last node of the closed range to splice
| *target*
| node before which the range is inserted, or 0
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
