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

Return true if the bidirectional list starting from the specified `head`, and ending with the specified `tail` is well formed&period; A bidirectional list is well formed if `tail &equals;&equals; 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)&colon;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
bool
isWellFormed(
    xref:BloombergLP/bslalg/BidirectionalLink.adoc[BidirectionalLink]* head,
    xref:BloombergLP/bslalg/BidirectionalLink.adoc[BidirectionalLink]* tail);
----

== Description

1&period; `h` and `t` are valid addresses&period; 2&period; `h&hyphen;&gt;nextLink()&hyphen;&gt;previousLink() &equals;&equals; h` is true&period; 3&period; `!h&hyphen;&gt;previousLink() &verbar;&verbar; h&hyphen;&gt;previousLink()&hyphen;&gt;nextLink() &equals;&equals; h` is true&period; 4&period; `t&hyphen;&gt;previousLink()&hyphen;&gt;nextLink() &equals;&equals; t` is true&period; 5&period; `!t&hyphen;&gt;nextLink() &verbar;&verbar; t&hyphen;&gt;nextLink()&hyphen;&gt;previousLink() &equals;&equals; t` is true&period; 6&period; For each `link` in the list different than `h` and `t` both `link&hyphen;&gt;nextLink()&hyphen;&gt;previousLink() &equals;&equals; link` and `link&hyphen;&gt;previousLink()&hyphen;&gt;nextLink() &equals;&equals; link` are true&period;

The behavior is undefined unless `tail` can be reached from `head` following the chain of `nextLink` attributes of all the nodes in the open range `&lsqb;head, tail)&rsqb;`&period;


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