Parma Polyhedra Library requirements
Internal embedded chain and owning-list interfaces
1. Embedded chain identity, links and ownership prerequisites PPL-SPEC-000642

Implementation::Doubly_Linked_Object shall provide an embedded forward/backward link pair; Implementation::EList<T> shall use a distinct owner-resident sentinel to form an ordered ring of T nodes. Valid linked use shall require live mutually reciprocal neighbor links and each node to belong to at most one chain. Node addresses shall remain fixed while linked. Copying or moving memberwise link fields shall not establish an independent ring; independent owner copying or relocation shall remain outside valid linked use.

List nodes shall expose their accessible Doubly_Linked_Object base, support the selected T::OK() const hook, and remain compatible with scalar delete T* while list-owned. Destructors shall not throw. A linked node shall remain alive until explicitly removed or destroyed; borrowed iterators shall obey 🔗 7. Embedded-list iterator borrowing and valid linked positions. These structures shall require no numerical-library initialization. The link operations themselves shall neither allocate nor copy element values.

2. Embedded-node construction and link initialization PPL-SPEC-000643

Construction with forward and backward pointers shall store those two pointers without updating neighbor objects. A self/self pair shall form an isolated reciprocal ring. Other supplied pairs shall require the caller to establish reciprocal links before linked use or destruction.

Default construction shall leave link storage unbound. Before navigation, erasure or destruction, the node shall be bound by a valid insertion operation or otherwise have a valid reciprocal link pair. Fresh default node storage may be supplied as the unlinked donor of 🔗 3. Insertion before and after a live embedded position, which shall initialize both links before using them. 🔗 1. Embedded chain identity, links and ownership prerequisites shall apply.

PPL-SPEC-000644
3. Insertion before and after a live embedded position PPL-SPEC-000644

Inserting an unlinked donor before or after a live linked target shall place exactly that donor between the target and its preceding or following neighbor, respectively. The donor shall be distinct from the target and shall not currently belong to a chain. Fresh unbound donors, isolated self-linked donors and previously removed donors shall be admitted. Both donor links and the corresponding reciprocal neighbor links shall be established. All other links, node values and object lifetimes shall be preserved. These base operations shall not transfer payload ownership or delete a donor; 🔗 1. Embedded chain identity, links and ownership prerequisites shall apply.

4. Embedded-node erasure and automatic unlink on destruction PPL-SPEC-000645

Erasing a live linked node shall reconnect its preceding and following neighbors, return its former following node, and leave every unrelated node's order and value unchanged. The removed node shall remain alive and caller-owned. It shall be independently destructible or insertable again; later operations on the surviving chain shall not cause its eventual destruction to remove or corrupt surviving nodes. Erasing an isolated self-linked node shall return that same node.

Destroying a currently linked node shall unlink it without destroying its neighbors or their payloads. Removal and destruction shall require valid initialized link use under 🔗 1. Embedded chain identity, links and ownership prerequisites and 🔗 2. Embedded-node construction and link initialization.

5. Empty owning-list construction and remaining-node destruction PPL-SPEC-000646

A new EList<T> shall contain no nodes and shall establish its own live sentinel with empty mutable and const iterator ranges. No element shall be constructed or allocated by empty-list construction.

The list shall own nodes admitted by 🔗 1. Embedded chain identity, links and ownership prerequisites while they remain linked in it. List destruction shall remove and scalar-delete every remaining node exactly once, then destroy the empty sentinel. Previously removed nodes shall remain outside this destruction obligation. Destruction shall not invoke handlers or other unrelated client actions beyond the nodes' own destruction effects.

PPL-SPEC-000647
6. Owning-list front, back and positional insertion PPL-SPEC-000647

Pushing a donor to the front or back shall add it as the first or last node, respectively. Positional insertion shall insert it immediately before the supplied current same-list position, admitting the end sentinel, and shall return an iterator to that donor. Each operation shall require a live unlinked donor eligible for list ownership under 🔗 1. Embedded chain identity, links and ownership prerequisites; it shall take ownership on successful insertion.

Insertion shall preserve existing node identity, relative order and values, including every retained iterator to existing nodes and the same owner sentinel. It shall not construct/copy a replacement payload or allocate backing storage. Empty, first, interior and end insertion shall be admitted.

PPL-SPEC-000648
7. Owning-list removal returns successor and node ownership PPL-SPEC-000648

Erasure shall require an occupied current same-list iterator. It shall remove exactly that node without deleting it, return its former following element or the same list's end, and transfer the removed node's ownership to the caller. Other node addresses, values and relative order, their live iterators and the owner sentinel shall remain unchanged. First, interior, last and sole-node removal shall be admitted.

The removed node shall be independently destructible or insertable into an eligible list, including after intervening operations on its former owner; its eventual cleanup shall not alter surviving-node membership. An emptied list shall remain reusable. Safe detachment shall retain 🔗 4. Embedded-node erasure and automatic unlink on destruction.

PPL-SPEC-000649
8. Owning-list empty queries and borrowed range endpoints PPL-SPEC-000649

empty() shall return true exactly when no nodes are linked between the list's sentinel links. Mutable and const begin() shall refer to the first node or, for an empty list, the owner sentinel. Each end() shall refer to that sentinel, whose identity shall remain stable during valid insertions/removals for the owner's lifetime. Mutable and const ranges shall traverse the same actual nodes in order, obeying 🔗 7. Embedded-list iterator borrowing and valid linked positions and 🔗 10. Embedded-list bidirectional traversal. No endpoint query shall copy, remove, allocate or delete a node.

PPL-SPEC-000650
9. Owning-list node validity hooks PPL-SPEC-000650

For a structurally valid live list under 🔗 1. Embedded chain identity, links and ownership prerequisites, OK() shall call the nodes' const OK() hooks in list order until the first false result or the end. It shall return false at the first false hook and true if all hooks return true, including an empty list. This result shall describe those node-hook outcomes; structural validity shall remain a precondition rather than a conclusion supplied by this query. Hooks shall retain chain structure and ownership.

An exception from a hook shall propagate, preserving list membership and node ownership when the hook itself preserves them. The list shall not destroy nodes or interpret such an exception as a successful true or false query result.