Dynamic array of arbitrary values This is a template for a general-purpose dynamic array
![]() | increment_ Linear growth increment */ |
![]() | vector_ dynamic array of values */ |
![]() | ~ValVec ( void ) Destructor |
![]() | ValVec ( size_t capacity = 0, size_t increment = 0 ) Default constructor |
![]() | ValVec ( const T &fill, size_t capacity, size_t increment ) Alternate constructor |
![]() | ValVec ( const ValVec& ) Copy constructor |
![]() | operator = ( const ValVec& ) Assignment/copy operator |
![]() | () ( size_t index ) const Efficient array operator (const version): no bounds checking |
![]() | () ( size_t index ) Efficient array operator (non-const version): no bounds checking |
![]() | operator [] ( size_t index ) const Bounds-checking array operator (const version): throws sxBoundsError |
![]() | operator [] ( size_t index ) Bounds-checking array operator (non-const version): throws sxBoundsError |
![]() | at ( size_t index ) Bounds-adjusting array operator |
![]() | length ( void ) const Returns current occupied length of array |
![]() | append ( const T& ) Efficiently insert given element at end of array |
![]() | insert ( size_t count, size_t offset = 0 ) Insert new array elements |
![]() | cut ( size_t count, size_t offset = 0 ) Remove array elements |
![]() | remove ( size_t offset ) Removes the element specified by offset |
![]() | keep ( size_t count ) Cut but keep capacity |
![]() | fill ( void ) Return the fill value, defining it if necessary |
![]() | fillExists ( void ) const Returns true if the fill value is defined |
![]() | unsetFill ( void ) Undefine and destroy the current fill value |
![]() | clear ( void ) Reset every value to the fill value |
![]() | sort ( int (*compar)(const void*, const void*) ) Do a qsort |
Dynamic array of arbitrary values This is a template for a general-purpose dynamic array. The array grows automatically as needed, but reallocation occurs only when the length exceeds the capacity. The capacity is increased in large blocks, the size of which may be optimized. A fill value may be defined, in which case it is used to initialize new elements of the array, but not new capacity. Which is to say that initialization is deferred until the array grows into its capacity. The public data member, increment_, specifies the amount by which the capacity is increased during reallocation. By default, increment_ is zero, which causes the capacity to double upon each reallocation. A non-zero increment_ is simply added to the capacity upon each reallocation. The capacity is extended by this amount or by whatever greater amount is necessary to accommodate the new length of the array.
ValVec( size_t capacity = 0, size_t increment = 0 )
ValVec( const T &fill, size_t capacity, size_t increment )
ValVec( const ValVec& )
ValVec& operator =( const ValVec& )
const T& operator ()( size_t index ) const
T& operator ()( size_t index )
const T& operator []( size_t index ) const
T& operator []( size_t index )
T& at( size_t index )
size_t length( void ) const
size_t append( const T& )
size_t insert( size_t count, size_t offset = 0 )
size_t cut( size_t count, size_t offset = 0 )
void remove( size_t offset )
size_t keep( size_t count )
T& fill( void )
bool fillExists( void ) const
void unsetFill( void )
void clear( void )
void sort( int (*compar)(const void*, const void*) )
alphabetic index hierarchy of classes