[#BloombergLP-bslalg-BidirectionalLinkListUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::BidirectionalLinkListUtil :relfileprefix: ../../ :mrdocs: This `struct` provides a namespace for utility functions that manipulate linked lists based on `bslalg::BidirectionalLink` nodes, including insertion, removal, and _splicing_. == Synopsis Declared in `<bslalg_bidirectionallinklistutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct BidirectionalLinkListUtil; ---- == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslalg/BidirectionalLinkListUtil/insertLinkAfterTarget.adoc[`insertLinkAfterTarget`] | Insert the specified `newNode` after the specified `target` node in the linked list that contains `target`. If the node following `target` is 0, then set the `nextLink` attribute of `newNode` to 0. After successful execution of this function the values of the `previousLink` and `nextLink` attributes of all the links in the list appropriately reflect the operation. The behavior is undefined unless `0 != newNode` and `0 != target`. The behavior is also undefined unless `0 == target‐>nextLink()` is true or `isWellFormed(target, target‐>nextLink())` are true. | xref:BloombergLP/bslalg/BidirectionalLinkListUtil/insertLinkBeforeTarget.adoc[`insertLinkBeforeTarget`] | Insert the specified `newNode` before the specified `target` node in the linked list that contains `target`. If `target` is 0, then the value of the attributes `nextLink` and `previousLink` of `newNode` is set to 0. After successful execution of this function the values of the `previousLink` and `nextLink` attributes of all the links in the list appropriately reflect the operation. The behavior is undefined unless `0 == target‐>previousLink()` is true or `isWellFormed(target‐>previousLink(), target)` is true. | xref:BloombergLP/bslalg/BidirectionalLinkListUtil/isWellFormed.adoc[`isWellFormed`] | Return true if the bidirectional list starting from the specified `head`, and ending with the specified `tail` is well formed. A bidirectional list is well formed if `tail == head` (0 values are allowed) or all of the following conditions are met (note that `head` is renamed to `h` and `tail` to `t` for brevity): | xref:BloombergLP/bslalg/BidirectionalLinkListUtil/spliceListBeforeTarget.adoc[`spliceListBeforeTarget`] | 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. | xref:BloombergLP/bslalg/BidirectionalLinkListUtil/unlink.adoc[`unlink`] | Unlink the specified `node` from the linked list of which it is a member. 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 Note that this method does _not_ change the value for the `nextLink` and `previousLink` attributes of `node`. The behavior is undefined unless `!node‐>previousLink()`, `!node‐>nextLink()`, or `isWellFormed(node‐>previousLink(), node‐>nextLink())` are true. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#