Internal swapping-vector row storage
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.
Internal row storage needs exact sequence and ownership meaning without imposing coefficient initialization on unrelated element types.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
template <typename T> class Swapping_Vector;
Compare complete sequences with independent literal models through storage histories and instantiate ordinary owned test elements without PPL initialization.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc.
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.
Internal row arrays need unambiguous empty and populated initial values and cleanup after partial element creation.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
Swapping_Vector(); explicit Swapping_Vector(dimension_type new_size); Swapping_Vector(dimension_type new_size, const T& x); template <typename Arg> requires std::constructible_from<T, const T&, const Arg&> Swapping_Vector(const Swapping_Vector& source, const Arg& argument);
Check zero/populated default and fill construction, source lifetime/independence for owning elements, and failures at each observed allocation during construction.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc; tests/systemconversionspec1.cc.
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.
Implicit standard-vector ownership operations are part of the wrapper interface even though its source declares no custom special members.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
Swapping_Vector(const Swapping_Vector&); Swapping_Vector& operator=(const Swapping_Vector&); Swapping_Vector(Swapping_Vector&&); Swapping_Vector& operator=(Swapping_Vector&&); ~Swapping_Vector();
Check independent owned copies and assignments, self-copy, source destruction, moved storage identities, replacement moves and self-move followed by clear/reuse.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc.
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.
Internal algorithms need to distinguish live size from spare storage and to use borrowed rows only while their positions remain valid.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
dimension_type size() const; dimension_type capacity() const; bool empty() const; dimension_type max_num_rows(); T& operator[](dimension_type i) &; const T& operator[](dimension_type i) const &; T& back() &; const T& back() const &; iterator begin() &; iterator end() &; const_iterator begin() const &; const_iterator end() const &;
Check empty/nonempty and const/mutable views, complete forward/reverse random-access traversal, mutation through live borrows and capacity/limit relationships. Check lvalue admission and temporary-owner rejection with compile-time client expressions. Preserve temporary iterator/view use and lvalue storage identity in runtime checks.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc. tests/rowstoragespec1.cc.
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.
Rows with separately owned coefficient storage should relocate by transferring ownership, and failed replacement preparation must leave their owner intact.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
void reserve(dimension_type new_capacity);
Check no-op and increasing reservations, exact values and payload identities, move-only relocation without default replacements, copy-only and potentially throwing move fallbacks, and every observed replacement-allocation failure.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; src/Sparse_Row_defs.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc.
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.
Row-array growth needs both default values and stable fill-argument meaning even when an argument comes from the current owner.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
void resize(dimension_type new_size); void resize(dimension_type new_size, const T& x);
Check growth/shrink/regrowth against a literal sequence model, default and external fill values, spare-capacity borrowed fills, preserved owned-resource identities and recoverable growth failures.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc.
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.
Appending must preserve the argument value across any storage growth and keep a clear ownership boundary for the final element.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
void push_back(const T& x); void reserve_consume(dimension_type new_capacity); void push_back_consume(T& x); void pop_back();
Check allocation-free prepared transfers, storage identity, restoration of internal donors, replacement-allocation failure, and repeated external appends through reallocation, borrowed arguments with spare capacity, independent owned copies, pop/reappend histories and copy-construction failure.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/rowtransferspec1.cc; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc.
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.
Internal row removal needs the same successor and ordering semantics as vector erasure without copying surviving row owners.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
iterator erase(iterator itr) &;
Check each position of small vectors and singleton removal, returned iterators, all survivor values and resource identities, unchanged capacity and no survivor copies. Check lvalue admission and temporary-owner rejection with compile-time client expressions. Preserve temporary iterator/view use and lvalue storage identity in runtime checks.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc. tests/rowstoragespec1.cc.
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.
Batch removal must preserve the row sequence and return a usable insertion/continuation position for every valid range.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
iterator erase(iterator first, iterator last) &;
Enumerate every half-open range of small vectors, compare literal retained indices and return positions, and check ownership identities, empty ranges and complete erasure. Check lvalue admission and temporary-owner rejection with compile-time client expressions. Preserve temporary iterator/view use and lvalue storage identity in runtime checks.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc. tests/rowstoragespec1.cc.
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.
Clearing storage for reuse differs from releasing all capacity, while exchanging owners must keep row resources together.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
void clear(); void m_swap(Swapping_Vector& v); template <typename T> void swap(Swapping_Vector<T>& x, Swapping_Vector<T>& y);
Check empty/populated owner exchanges and self-swaps, capacity exchange, clear followed by regrowth, unchanged retained storage and absence of element-copy operations.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc.
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.
Row-vector diagnostics must count spare row slots as well as the coefficient storage held by live rows.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
memory_size_type external_memory_in_bytes() const;
Compute the independent capacity-plus-live-payload identity across construction, reserve, resize, erase, clear, copies and swaps, checking unchanged complete values and owner addresses.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc.
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.
Generic row storage needs failure guarantees that distinguish safe replacement preparation from potentially partial element assignment.
Internal source header: Swapping_Vector_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to Swapping_Vector<T>. iterator and const_iterator are the corresponding std::vector<T> types.
Swapping_Vector(dimension_type new_size); Swapping_Vector(dimension_type new_size, const T& x); Swapping_Vector& operator=(const Swapping_Vector&); void reserve(dimension_type new_capacity); void resize(dimension_type new_size); void resize(dimension_type new_size, const T& x); void push_back(const T& x);
Inject each observed allocation and element copy/default construction failure, check source values and resource balance, inspect preserved logical sequences where promised, and clear/reuse valid owners after partial copy-assignment failure.
src/Swapping_Vector_defs.hh; src/Swapping_Vector_inlines.hh; tests/swappingvectorspec1.cc; tests/swappingvectorerase1.cc; tests/systemconversionspec1.cc; tests/systembulktransferspec1.cc.