Documentation Index
Fetch the complete documentation index at: https://mintlify.com/niklasso/minisat/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Thevec<T> template class provides an automatically resizable array implementation optimized for performance. It uses realloc for memory management and grows by approximately 3/2 when capacity is exceeded.
Template parameters
The element type to store in the vector
The integer type used for size and capacity tracking
Type definitions
Public typedef for the size type used by the vector
Constructors
Default constructor
Size constructor
Initial size of the vector. Elements are default-constructed.
Size with padding constructor
Initial size of the vector
Value to copy into all elements
Size operations
size
capacity
Minimum capacity to ensure is available
shrink
nelems elements from the end of the vector and calls their destructors.
Number of elements to remove (must be ≤ current size)
shrink_
shrink that does not call destructors. Use only when element destructors are trivial.
growTo
pad.
Target size for the vector
Value to copy into new elements (if provided)
clear
If true, also frees the allocated memory
Stack interface
push
Element to add to the vector
Overflow cannot occur in the
sz+1 expression because capacity is always even but INT_MAX is odd.push_
Element to add to the vector
pop
last
Vector interface
operator[]
Zero-based index of the element to access
operator T*
Duplication operations
copyTo
Destination vector (will be cleared first)
moveTo
Destination vector (will be cleared first)
Usage example
Performance characteristics
- Random access: O(1)
- Push operation: Amortized O(1)
- Pop operation: O(1)
- Growth factor: Approximately 3/2
- Memory overhead: Minimal (three words: data pointer, size, capacity)