Parma Polyhedra Library requirements
Internal swapping-vector row storage
1. Owned element sequence and valid swapping-vector use PPL-SPEC-000581

Swapping_Vector<T> shall own a finite ordered sequence of element objects with a separately allocated capacity. Its logical value shall be that sequence, independently of unused capacity. Each selected member shall require the element construction, copying, assignment, destruction and swap capabilities instantiated by that member. Element destruction and the ordinary swaps used for relocation and erasure shall not throw. Swaps shall support self-indices where an admitted operation uses them.

Calls shall require live objects, valid indices and ranges, supported nonoverflowing size/capacity calculations and sufficient resources. Callers shall prevent access conflicting with concurrent mutation. No initialization stage additional to the selected element type's own prerequisites shall be required.

PPL-SPEC-000582
2. Empty, default-element and fill construction PPL-SPEC-000582

Default construction shall produce an empty sequence. Size construction shall produce exactly the specified number of value-initialized values, using the vector element-initialization rules. Fill construction shall produce that many element copies of its argument, according to T copy semantics, and preserve the argument. Zero size shall be admitted. Successfully constructed elements shall belong to the new owner, and construction failure shall destroy every element already constructed for that incomplete owner. Parameterized copy construction shall construct each destination element from its corresponding const source element and the supplied additional argument, without default-constructing replacement elements. It shall preserve source order and values and clean up partial destination construction on failure.

PPL-SPEC-000583
3. Implicit copies, moves and destruction preserve element ownership PPL-SPEC-000583

The implicitly provided copy construction and assignment shall preserve the source sequence and create distinct element objects according to T copy semantics. Copy assignment shall admit self-assignment and return its target. For element types with independent owning copies, the copied values shall remain usable after source mutation or destruction.

The implicitly provided move construction and assignment shall transfer the source vector's storage and sequence to the target, releasing the assignment target's prior elements. Their source shall remain valid for destruction, clearing and reuse; its prior size or contents shall not be promised after a non-self move. Self-move assignment shall leave a valid owner. Destruction shall destroy all retained elements and release the allocated vector storage.

PPL-SPEC-000584
4. Size, capacity, borrowed elements and iterator range PPL-SPEC-000584

size() shall report the live element count, empty() exactly whether that count is zero, and capacity() the number of allocated element slots. Capacity shall be at least size. max_num_rows() shall report the underlying vector's maximum element count, without promising that allocation of that count will succeed.

Indexed access shall borrow the selected element for indices below size; back() shall borrow the last element and require a nonempty sequence. Const access shall return const references. The iterator range shall visit exactly the current sequence in order with standard random-access vector-iterator semantics. References and iterators shall not outlive their elements or survive a storage reallocation; removals shall also invalidate positions at and after the removed region. Swapping owners shall transfer their element storage and borrows to the other owner.

Member overloads that return references, iterators or nonowning views into the owner shall require an lvalue owner. Matching rvalue calls that would produce such borrows shall be rejected during overload resolution. Temporary iterator and row-view values shall remain usable while their backing owner remains alive.

5. Reservation transfers element owners and preserves the sequence PPL-SPEC-000585

Reservation at or below current capacity shall preserve the sequence, capacity, element locations and existing borrows. A successful larger reservation shall establish capacity at least the requested count while preserving size and every element value. Element ownership shall transfer without deep copying retained resources. For nonthrowing move construction, reservation may move-construct the retained elements directly into new backing storage, without constructing intermediate default elements. A nontrivial copy-only type whose noexcept copy satisfies the move-construction trait shall retain the swap path. Other element types shall use default-constructed live replacement slots and unqualified ordinary swaps with standard overloads available. A particular growth factor or exact capacity shall not be promised.

With the nonthrowing moves or swaps of 🔗 1. Owned element sequence and valid swapping-vector use, a recoverable allocation or replacement-element construction failure shall preserve the original sequence, capacity and element locations and release the incomplete replacement storage.

6. Resizing retains the prefix and initializes added elements PPL-SPEC-000586

A successful resize shall establish the requested size, preserve the common prefix and discard the removed suffix. The no-argument form shall value-initialize each added element. The fill form shall initialize each added element as a copy of the argument's value on entry. A live argument borrowed from a retained element shall be admitted, including when growth reallocates storage. Added copies shall have T copy semantics and shall not change the argument's value.

Shrinking shall retain allocated capacity. Growing shall reserve storage as needed, without copying the retained elements for relocation. A recoverable failure during growth shall preserve the preceding logical sequence; capacity and element locations may have changed after a successful preliminary reservation.

7. Appending copies the argument value and popping removes the suffix PPL-SPEC-000587

A successful push_back(x) shall append one element copy of the argument's entry value and preserve all preceding values. A live argument borrowed from an existing element shall be admitted, including when insertion reallocates storage. The resulting sequence shall have size increased by one, with T copy semantics for its new element. A recoverable construction/allocation failure shall preserve the prior logical sequence; preliminary reservation may have changed capacity and element locations.

pop_back() shall require a nonempty sequence, destroy exactly the last element and preserve every preceding value and allocated capacity.

Internal disposable owners may opt into nonthrowing transfer construction. When growth is needed, reserve_consume(n) shall allocate a replacement buffer before transferring any live owner. It shall destroy the old transient owners after committing the replacement. push_back_consume(x) shall require an independent donor that is destroyed or restored before further descriptor use. Prepared transfers of participating descriptor types shall allocate no descriptor backend. Nonparticipating element types shall retain the established reserve and swap paths.

PPL-SPEC-000588
8. Single-element erase preserves survivor order and ownership PPL-SPEC-000588

Single-element erase shall require a dereferenceable iterator in the current vector. It shall remove exactly that element and shift each following value one position toward the beginning using element swaps. The order and owned value of every survivor shall be preserved and capacity retained. The returned iterator shall denote the shifted successor or the new end when the removed element was last. Erasing a singleton shall return the empty sequence's end. Instantiation shall require an applicable unqualified element swap in this member's scope.

Member overloads that return references, iterators or nonowning views into the owner shall require an lvalue owner. Matching rvalue calls that would produce such borrows shall be rejected during overload resolution. Temporary iterator and row-view values shall remain usable while their backing owner remains alive.

PPL-SPEC-000589
9. Range erase preserves the ordered complement PPL-SPEC-000589

Range erase shall require an ordered half-open range within the current iterator range, including an empty range and the full range. It shall remove exactly those positions, preserve every survivor in its original relative order and retain capacity. Element swaps shall move the surviving suffix into the removed positions. The returned iterator shall denote the first position after the retained prefix, which shall be the new end if no suffix survives. An empty range shall preserve the sequence and return its first iterator.

Member overloads that return references, iterators or nonowning views into the owner shall require an lvalue owner. Matching rvalue calls that would produce such borrows shall be rejected during overload resolution. Temporary iterator and row-view values shall remain usable while their backing owner remains alive.

PPL-SPEC-000590
10. Clearing retains capacity and swaps exchange complete owners PPL-SPEC-000590

clear() shall destroy every live element and establish size zero while retaining allocated vector capacity. Member and free swaps shall exchange complete sequences and capacities without copying elements. They shall admit self-swap and preserve each transferred element's owned value and the validity of its lifetime in the receiving owner. Cleared and swapped owners shall remain usable for subsequent mutation.

PPL-SPEC-000591
11. Allocated-memory accounting includes spare slots and live payloads PPL-SPEC-000591

When T supplies external_memory_in_bytes(), the wrapper's external-memory query shall return allocated element capacity multiplied by sizeof(T), plus the external memory reported by every live element. It shall preserve sequence, size, capacity and ownership. The count shall describe owned allocation payload, excluding allocator bookkeeping, and shall not predict future allocation success. In particular, clearing shall remove live-element payload from the count while retaining the capacity term.

PPL-SPEC-000592
12. Recoverable element-construction failures preserve surviving owners PPL-SPEC-000592

For admitted element operations with ordinary source-preserving copy semantics, recoverable construction failures shall destroy every newly created element that does not become part of a successful result and release temporary replacement storage. Failed construction of the wrapper shall release its partial vector and elements. Failed reserve shall satisfy 🔗 5. Reservation transfers element owners and preserves the sequence; failed append/resize shall satisfy 🔗 6. Resizing retains the prefix and initializes added elements and 🔗 7. Appending copies the argument value and popping removes the suffix.

Copy assignment may leave a partially updated element sequence when an element assignment throws, subject to the element type's own valid-state guarantees; it shall not promise universal rollback. Every surviving wrapper shall remain valid for destruction and clearing, and all remaining element ownership shall follow the selected element type's failure guarantees.