libUTL++
utl::Vector< T > Class Template Reference

A sequence of same-type objects. More...

#include <Vector.h>

Inheritance diagram for utl::Vector< T >:

Public Member Functions

 Vector (std::initializer_list< T > list)
 Constructor. More...
 
 Vector (size_t size, size_t increment=1)
 Constructor. More...
 
 Vector (T *array, size_t size, bool owner=true, size_t increment=1)
 Constructor. More...
 
Various Read-Only Operations
virtual int compare (const Object &rhs) const
 Compare with another object. More...
 
virtual size_t innerAllocatedSize () const
 Get the "inner" allocated size. More...
 
bool isOwner () const
 Get the owner flag. More...
 
bool autoInit () const
 Get the autoInit flag. More...
 
const T * get () const
 Get the associated array. More...
 
T * get ()
 Get the associated array. More...
 
const T & get (size_t idx) const
 Get a const reference to the object at the given index. More...
 
const T & get (int idx) const
 get() with int parameter. More...
 
bool empty () const
 Is the sequence empty?
 
size_t length () const
 Get the size of the sequence. More...
 
size_t size () const
 Get the size of the sequence. More...
 
size_t increment () const
 Get the growth increment. More...
 
Iterators
const_iterator begin () const
 Get begin iterator (const version). More...
 
const_iterator end () const
 Get end iterator (const version). More...
 
const_iterator cbegin ()
 Get begin iterator (const version). More...
 
const_iterator cend ()
 Get end iterator (const version). More...
 
iterator begin ()
 Get begin iterator. More...
 
iterator end ()
 Get end iterator. More...
 
Iterator -> Index Conversions
size_t indexOf (const_iterator it) const
 Convert iterator to index. More...
 
size_t indexOf (iterator it)
 Convert iterator to index. More...
 
Modification
void clear ()
 Empty the sequence. More...
 
void excise ()
 Empty the sequence, delete the allocated array (if isOwner()) and set it to nullptr. More...
 
void economize ()
 Make the allocation exactly large enough to contain the sequence. More...
 
virtual void steal (Object &rhs)
 "Steal" the internal representation from another instance. More...
 
virtual void copy (const Object &)
 Copy another instance. More...
 
void copy (size_t idx, const Vector< T > &src, size_t srcBegin=0, size_t srcEnd=size_t_max)
 Copy (part of) another vector. More...
 
void copy (size_t idx, const T *src, size_t srcBegin, size_t srcEnd)
 Copy (part of) the given sequence. More...
 
void copy (size_t idx, std::initializer_list< T > list)
 Copy an initializer_list into this sequence. More...
 
void move (size_t idx, const Vector< T > &src, size_t srcBegin=0, size_t srcEnd=size_t_max)
 Move (part of) another vector. More...
 
void move (size_t idx, T *src, size_t srcBegin, size_t srcEnd)
 Move (part of) the given sequence. More...
 
virtual void serialize (Stream &stream, uint_t io, uint_t mode=ser_default)
 Serialize to or from a stream. More...
 
void setOwner (bool owner)
 Set the ownership flag. More...
 
void assertOwner ()
 Ensure that self owns the allocation. More...
 
void assertOwner (size_t allocSize)
 Ensure that self owns the allocation. More...
 
void assertOwner (size_t allocSize, size_t increment)
 Ensure that self owns the allocation. More...
 
T & get (size_t idx)
 Get a reference to the object at the given index. More...
 
T & get (int idx)
 get() with int parameter. More...
 
void setSize (size_t size)
 Set the size of the sequence. More...
 
void grow (size_t size)
 Ensure the sequence is no smaller than the given size. More...
 
void grow (size_t size, size_t increment)
 Ensure the sequence is no smaller than the given size. More...
 
void reserve (size_t allocSize)
 Reserve allocation space. More...
 
void reserve (size_t allocSize, size_t increment)
 Reserve allocation space. More...
 
void setAutoInit (bool autoInit)
 Set the autoInit flag. More...
 
void append (const T &val)
 Append an object to the sequence. More...
 
void append (const Vector< T > &v)
 Append another sequence to this one. More...
 
void append (const T *array, size_t arraySize)
 Append another sequence to this one. More...
 
void append (std::initializer_list< T > list)
 Append another sequence to this one. More...
 
void insert (size_t idx, size_t num)
 Insert uninitialized objects in the range [idx,idx+num). More...
 
void insert (size_t idx, size_t num, const T &val)
 Insert objects into the sequence. More...
 
void insert (size_t idx, size_t num, const T *val)
 Insert objects into the sequence. More...
 
void insert (size_t idx, const T *array, size_t arraySize)
 Insert another sequence into this one. More...
 
void insert (size_t idx, std::initializer_list< T > list)
 Insert another sequence into this one. More...
 
void remove (size_t idx, size_t num)
 Remove objects from the sequence. More...
 
void relocate (size_t destIdx, size_t srcIdx)
 Relocate one object within the sequence. More...
 
void reverse (size_t idx, size_t num)
 Reverse the order of the objects in the sequence. More...
 
void set (T *array, size_t size)
 clear(), then set the given array/size. More...
 
void set (T *array, size_t size, bool owner, size_t increment)
 clear(), then set the given array/size and owner flag. More...
 
void set (const T &val)
 Assign val to all objects in the sequence. More...
 
void set (size_t idx, size_t num, const T &val)
 Assign a value to objects in the sequence. More...
 
void set (size_t idx, const T &val)
 Set the value of the object at the given index. More...
 
void setIncrement (size_t increment)
 Set the growth increment. More...
 
void swap (size_t i, size_t j)
 Swap the objects at the given indexes. More...
 
void swap (size_t i, size_t j, size_t n)
 Swap the sub-arrays described by the index ranges [i, i + n) and [j, j + n).
 
Operators
T & operator[] (size_t idx)
 Array access operator. More...
 
const T & operator[] (size_t idx) const
 Array access operator. More...
 
T & operator[] (int idx)
 Same as above, but takes an int parameter. More...
 
const T & operator[] (int idx) const
 Same as above, but takes an int parameter. More...
 
 operator const T * () const
 Conversion to const T*. More...
 
 operator const T * ()
 Conversion to const T*. More...
 
 operator T* ()
 Conversion to T*. More...
 
 operator const void * () const
 Conversion to const void*. More...
 
 operator const void * ()
 Conversion to const void*. More...
 
 operator void * ()
 Conversion to void*. More...
 
T * operator+ (ssize_t n)
 Pointer addition (ssize_t argument). More...
 
const T * operator+ (ssize_t n) const
 Pointer addition (ssize_t argument). More...
 
T * operator+ (size_t n)
 Pointer addition (size_t argument). More...
 
const T * operator+ (size_t n) const
 Pointer addition (size_t argument). More...
 
- Public Member Functions inherited from utl::Object
void clear ()
 Revert to initial state. More...
 
virtual void vclone (const Object &rhs)
 Make an exact copy of another instance. More...
 
virtual void dump (Stream &os, uint_t level=uint_t_max) const
 Dump a human-readable representation of self to the given output stream. More...
 
void dumpWithClassName (Stream &os, uint_t indent=4, uint_t level=uint_t_max) const
 Front-end for dump() that prints the object's class name. More...
 
virtual const ObjectgetKey () const
 Get the key for this object. More...
 
bool hasKey () const
 Determine whether or not the object has a key. More...
 
virtual const ObjectgetProxiedObject () const
 Get the proxied object (= self if none). More...
 
virtual ObjectgetProxiedObject ()
 Get the proxied object (= self if none). More...
 
virtual size_t hash (size_t size) const
 Get the hash code for the object. More...
 
bool _isA (const RunTimeClass *runTimeClass) const
 Determine whether self's class is a descendent of the given class. More...
 
virtual String toString () const
 Return a string representation of self. More...
 
 operator String () const
 Conversion to String. More...
 
size_t allocatedSize () const
 Get the total allocated size of this object. More...
 
virtual void addOwnedIt (const class FwdIt *it) const
 Notify self that it owns the given iterator. More...
 
virtual void removeOwnedIt (const class FwdIt *it) const
 Notify self that the given owned iterator has been destroyed. More...
 
bool operator< (const Object &rhs) const
 Less-than operator. More...
 
bool operator<= (const Object &rhs) const
 Less-than-or-equal-to operator. More...
 
bool operator> (const Object &rhs) const
 Greater-than operator. More...
 
bool operator>= (const Object &rhs) const
 Greater-than-or-equal-to operator. More...
 
bool operator== (const Object &rhs) const
 Equal-to operator. More...
 
bool operator!= (const Object &rhs) const
 Unequal-to operator. More...
 
void serializeIn (Stream &is, uint_t mode=ser_default)
 Serialize from an input stream. More...
 
void serializeOut (Stream &os, uint_t mode=ser_default) const
 Serialize to an output stream. More...
 
void serializeOutBoxed (Stream &os, uint_t mode=ser_default) const
 Serialize a boxed object to an output stream. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from utl::Object
static ObjectserializeInNullable (Stream &is, uint_t mode=ser_default)
 Serialize a nullptr-able object from an input stream. More...
 
static void serializeOutNullable (const Object *object, Stream &os, uint_t mode=ser_default)
 Serialize a nullptr-able object to an output stream. More...
 
static void serializeNullable (Object *&object, Stream &stream, uint_t io, uint_t mode=ser_default)
 Serialize a nullptr-able object to or from a stream. More...
 
static ObjectserializeInBoxed (Stream &is, uint_t mode=ser_default)
 Serialize a boxed object from an input stream. More...
 
static void serializeBoxed (Object *&object, Stream &stream, uint_t io, uint_t mode=ser_default)
 Serialize a boxed object to or from a stream. More...
 
- Protected Member Functions inherited from utl::FlagsMI
 FlagsMI ()
 Constructor. More...
 
virtual ~FlagsMI ()
 Destructor. More...
 
void copyFlags (const FlagsMI &rhs)
 Copy the given flags. More...
 
void copyFlags (const FlagsMI &rhs, uint_t lsb, uint_t msb)
 Copy (some of) the given flags. More...
 
void copyFlags (uint64_t flags, uint_t lsb, uint_t msb)
 Copy (some of) the given flags. More...
 
bool getFlag (uint_t flagNum) const
 Get a user-defined flag. More...
 
void setFlag (uint_t flagNum, bool val)
 Set a user-defined flag. More...
 
uint64_t getFlagsNumber (uint64_t mask, uint64_t shift=0)
 Get a multi-bit value in the flags data (which is stored as one 64-bit integer). More...
 
void setFlagsNumber (uint64_t mask, uint64_t shift, uint64_t num)
 Set a multi-bit value in the flags data (which is stored as one 64-bit integer). More...
 
uint64_t getFlags () const
 Get the flags. More...
 
void setFlags (uint64_t flags)
 Set the flags. More...
 

Detailed Description

template<typename T>
class utl::Vector< T >

A sequence of same-type objects.

Attributes

  • array : The array of objects.
  • size : The size of the sequence (size <= allocSize).
  • allocSize : The number of objects that can be stored in the present allocation.
  • increment : When the allocation is to be grown, the growth increment determines the amount of growth. For example, if increment = 16, the allocation will always be grown by a multiple of 16. As a special case, if increment = size_t_max, the allocation will be doubled in size until it is >= the required size. The default is to allocate exactly the amount of memory that's immediately required (increment = 1).
  • owner flag : If a Vector owns its associated array, it is responsible for deleting the array when appropriate (e.g. upon its destruction).
  • autoInit flag : When the sequence grows, newly created objects may optionally be initialized with the default value for the contained type.
Author
Adam McKee

Definition at line 14 of file Ordering.h.

Constructor & Destructor Documentation

◆ Vector() [1/3]

template<typename T>
utl::Vector< T >::Vector ( std::initializer_list< T >  list)

Constructor.

Parameters
listinitializer list

Definition at line 740 of file Vector.h.

◆ Vector() [2/3]

template<typename T>
utl::Vector< T >::Vector ( size_t  size,
size_t  increment = 1 
)

Constructor.

Parameters
sizesequence size
increment(optional : 1) growth increment

Definition at line 750 of file Vector.h.

◆ Vector() [3/3]

template<typename T>
utl::Vector< T >::Vector ( T *  array,
size_t  size,
bool  owner = true,
size_t  increment = 1 
)

Constructor.

Parameters
arrayassociated array
sizesequence size
owner(optional : true) owner flag
increment(optional : 1) growth increment

Definition at line 758 of file Vector.h.

Member Function Documentation

◆ compare()

template<typename T >
int utl::Vector< T >::compare ( const Object rhs) const
virtual

Compare with another object.

If no overridden version succeeds in doing the comparison, then an attempt will be made to re-start the comparison process using one or both of the objects' keys. Usually, an override of compare() should call the superclass's compare() if it doesn't know how to compare itself with the rhs object.

See also
getKey
Returns
< 0 if self < rhs, 0 if self = rhs, > 0 if self > rhs
Parameters
rhsobject to compare with

Reimplemented from utl::Object.

Definition at line 795 of file Vector.h.

◆ innerAllocatedSize()

template<typename T>
virtual size_t utl::Vector< T >::innerAllocatedSize ( ) const
inlinevirtual

Get the "inner" allocated size.

Reimplemented from utl::Object.

Definition at line 81 of file Vector.h.

◆ isOwner()

template<typename T>
bool utl::Vector< T >::isOwner ( ) const
inline

Get the owner flag.

Definition at line 89 of file Vector.h.

◆ autoInit()

template<typename T>
bool utl::Vector< T >::autoInit ( ) const
inline

Get the autoInit flag.

Definition at line 96 of file Vector.h.

◆ get() [1/6]

template<typename T>
const T* utl::Vector< T >::get ( ) const
inline

Get the associated array.

Definition at line 103 of file Vector.h.

◆ get() [2/6]

template<typename T>
T* utl::Vector< T >::get ( )
inline

Get the associated array.

Definition at line 110 of file Vector.h.

◆ get() [3/6]

template<typename T>
const T& utl::Vector< T >::get ( size_t  idx) const
inline

Get a const reference to the object at the given index.

Definition at line 117 of file Vector.h.

◆ get() [4/6]

template<typename T>
const T& utl::Vector< T >::get ( int  idx) const
inline

get() with int parameter.

Definition at line 125 of file Vector.h.

◆ length()

template<typename T>
size_t utl::Vector< T >::length ( ) const
inline

Get the size of the sequence.

Definition at line 148 of file Vector.h.

◆ size()

template<typename T>
size_t utl::Vector< T >::size ( ) const
inline

Get the size of the sequence.

Definition at line 155 of file Vector.h.

◆ increment()

template<typename T>
size_t utl::Vector< T >::increment ( ) const
inline

Get the growth increment.

Definition at line 162 of file Vector.h.

◆ begin() [1/2]

template<typename T>
const_iterator utl::Vector< T >::begin ( ) const
inline

Get begin iterator (const version).

Definition at line 172 of file Vector.h.

◆ end() [1/2]

template<typename T>
const_iterator utl::Vector< T >::end ( ) const
inline

Get end iterator (const version).

Definition at line 179 of file Vector.h.

◆ cbegin()

template<typename T>
const_iterator utl::Vector< T >::cbegin ( )
inline

Get begin iterator (const version).

Definition at line 186 of file Vector.h.

◆ cend()

template<typename T>
const_iterator utl::Vector< T >::cend ( )
inline

Get end iterator (const version).

Definition at line 193 of file Vector.h.

◆ begin() [2/2]

template<typename T>
iterator utl::Vector< T >::begin ( )
inline

Get begin iterator.

Definition at line 200 of file Vector.h.

◆ end() [2/2]

template<typename T>
iterator utl::Vector< T >::end ( )
inline

Get end iterator.

Definition at line 207 of file Vector.h.

◆ indexOf() [1/2]

template<typename T>
size_t utl::Vector< T >::indexOf ( const_iterator  it) const
inline

Convert iterator to index.

Definition at line 217 of file Vector.h.

◆ indexOf() [2/2]

template<typename T>
size_t utl::Vector< T >::indexOf ( iterator  it)
inline

Convert iterator to index.

Definition at line 225 of file Vector.h.

◆ clear()

template<typename T>
void utl::Vector< T >::clear ( )
inline

Empty the sequence.

Definition at line 236 of file Vector.h.

◆ excise()

template<typename T >
void utl::Vector< T >::excise ( )

Empty the sequence, delete the allocated array (if isOwner()) and set it to nullptr.

Definition at line 783 of file Vector.h.

◆ economize()

template<typename T >
void utl::Vector< T >::economize ( )

Make the allocation exactly large enough to contain the sequence.

Definition at line 767 of file Vector.h.

◆ steal()

template<typename T >
void utl::Vector< T >::steal ( Object rhs)
virtual

"Steal" the internal representation from another instance.

The default implementation just calls vclone(), so you have to override this if you want a "move" capability.

Reimplemented from utl::Object.

Definition at line 806 of file Vector.h.

◆ copy() [1/4]

template<typename T >
void utl::Vector< T >::copy ( const Object rhs)
virtual

Copy another instance.

When you override copy(), you should usually call the superclass's copy().

Parameters
rhsobject to copy

Reimplemented from utl::Object.

Definition at line 824 of file Vector.h.

◆ copy() [2/4]

template<typename T>
void utl::Vector< T >::copy ( size_t  idx,
const Vector< T > &  src,
size_t  srcBegin = 0,
size_t  srcEnd = size_t_max 
)
inline

Copy (part of) another vector.

The portion of the source vector [srcBegin,srcEnd) is copied into this vector starting at position idx.

Parameters
idxdestination index
srcvector to copy objects from
srcBegin(optional : 0) source begin index
srcEnd(optional : size_t_max) source end index

Definition at line 260 of file Vector.h.

◆ copy() [3/4]

template<typename T>
void utl::Vector< T >::copy ( size_t  idx,
const T *  src,
size_t  srcBegin,
size_t  srcEnd 
)

Copy (part of) the given sequence.

The part of the source sequence [srcBegin,srcEnd) is copied into this vector starting at position idx.

Parameters
idxdestination index
srcsequence to copy objects from
srcBegin(optional : 0) source begin index
srcEnd(optional : size_t_max) source end index

Definition at line 856 of file Vector.h.

◆ copy() [4/4]

template<typename T>
void utl::Vector< T >::copy ( size_t  idx,
std::initializer_list< T >  list 
)

Copy an initializer_list into this sequence.

Parameters
idxindex to start copying into
listinitializer list

Definition at line 879 of file Vector.h.

◆ move() [1/2]

template<typename T>
void utl::Vector< T >::move ( size_t  idx,
const Vector< T > &  src,
size_t  srcBegin = 0,
size_t  srcEnd = size_t_max 
)
inline

Move (part of) another vector.

The portion of the source vector [srcBegin,srcEnd) is moved into this vector starting at position idx.

Parameters
idxdestination index
srcvector to copy objects from
srcBegin(optional : 0) source begin index
srcEnd(optional : size_t_max) source end index

Definition at line 291 of file Vector.h.

◆ move() [2/2]

template<typename T>
void utl::Vector< T >::move ( size_t  idx,
T *  src,
size_t  srcBegin,
size_t  srcEnd 
)

Move (part of) the given sequence.

The part of the source sequence [srcBegin,srcEnd) is moved into this vector starting at position idx.

Parameters
idxdestination index
srcsequence to copy objects from
srcBegin(optional : 0) source begin index
srcEnd(optional : size_t_max) source end index

Definition at line 890 of file Vector.h.

◆ serialize()

template<typename T >
void utl::Vector< T >::serialize ( Stream stream,
uint_t  io,
uint_t  mode = ser_default 
)
virtual

Serialize to or from a stream.

This is the only virtual method for serialization. You must override this in any class that has data to be serialized, and ensure that the superclass's serialize() gets called.

Parameters
streamstream to serialize from/to
iosee utl::io_t
modesee utl::serialize_t

Reimplemented from utl::Object.

Reimplemented in utl::BinaryData.

Definition at line 913 of file Vector.h.

◆ setOwner()

template<typename T>
void utl::Vector< T >::setOwner ( bool  owner)
inline

Set the ownership flag.

Definition at line 310 of file Vector.h.

◆ assertOwner() [1/3]

template<typename T >
void utl::Vector< T >::assertOwner ( )

Ensure that self owns the allocation.

Definition at line 945 of file Vector.h.

◆ assertOwner() [2/3]

template<typename T >
void utl::Vector< T >::assertOwner ( size_t  allocSize)

Ensure that self owns the allocation.

Parameters
allocSizenew size of sequence

Definition at line 973 of file Vector.h.

◆ assertOwner() [3/3]

template<typename T>
void utl::Vector< T >::assertOwner ( size_t  allocSize,
size_t  increment 
)
inline

Ensure that self owns the allocation.

Parameters
allocSizenew size of sequence
incrementgrowth increment

Definition at line 330 of file Vector.h.

◆ get() [5/6]

template<typename T>
T& utl::Vector< T >::get ( size_t  idx)
inline

Get a reference to the object at the given index.

Definition at line 338 of file Vector.h.

◆ get() [6/6]

template<typename T>
T& utl::Vector< T >::get ( int  idx)
inline

get() with int parameter.

Definition at line 346 of file Vector.h.

◆ setSize()

template<typename T >
void utl::Vector< T >::setSize ( size_t  size)

Set the size of the sequence.

Definition at line 1021 of file Vector.h.

◆ grow() [1/2]

template<typename T >
void utl::Vector< T >::grow ( size_t  size)

Ensure the sequence is no smaller than the given size.

Parameters
sizerequired minimum size

Definition at line 1032 of file Vector.h.

◆ grow() [2/2]

template<typename T>
void utl::Vector< T >::grow ( size_t  size,
size_t  increment 
)
inline

Ensure the sequence is no smaller than the given size.

Parameters
sizerequired minimum size
incrementgrowth increment

Definition at line 375 of file Vector.h.

◆ reserve() [1/2]

template<typename T>
void utl::Vector< T >::reserve ( size_t  allocSize)
inline

Reserve allocation space.

Parameters
allocSizeminimum allocation size

Definition at line 386 of file Vector.h.

◆ reserve() [2/2]

template<typename T>
void utl::Vector< T >::reserve ( size_t  allocSize,
size_t  increment 
)
inline

Reserve allocation space.

Parameters
allocSizeminimum allocation size
incrementgrowth increment

Definition at line 397 of file Vector.h.

◆ setAutoInit()

template<typename T>
void utl::Vector< T >::setAutoInit ( bool  autoInit)
inline

Set the autoInit flag.

Definition at line 404 of file Vector.h.

◆ append() [1/4]

template<typename T>
void utl::Vector< T >::append ( const T &  val)
inline

Append an object to the sequence.

Definition at line 411 of file Vector.h.

◆ append() [2/4]

template<typename T>
void utl::Vector< T >::append ( const Vector< T > &  v)
inline

Append another sequence to this one.

Definition at line 418 of file Vector.h.

◆ append() [3/4]

template<typename T>
void utl::Vector< T >::append ( const T *  array,
size_t  arraySize 
)

Append another sequence to this one.

Definition at line 1044 of file Vector.h.

◆ append() [4/4]

template<typename T>
void utl::Vector< T >::append ( std::initializer_list< T >  list)

Append another sequence to this one.

Definition at line 1065 of file Vector.h.

◆ insert() [1/5]

template<typename T >
void utl::Vector< T >::insert ( size_t  idx,
size_t  num 
)

Insert uninitialized objects in the range [idx,idx+num).

Definition at line 1075 of file Vector.h.

◆ insert() [2/5]

template<typename T>
void utl::Vector< T >::insert ( size_t  idx,
size_t  num,
const T &  val 
)
inline

Insert objects into the sequence.

Parameters
idxindex where objects are to be inserted
numnumber of objects to insert
valinitial value for each new object

Definition at line 439 of file Vector.h.

◆ insert() [3/5]

template<typename T>
void utl::Vector< T >::insert ( size_t  idx,
size_t  num,
const T *  val 
)
inline

Insert objects into the sequence.

Parameters
idxindex where objects are to be added
numnumber of objects to insert
valinitial value for inserted objects

Definition at line 452 of file Vector.h.

◆ insert() [4/5]

template<typename T>
void utl::Vector< T >::insert ( size_t  idx,
const T *  array,
size_t  arraySize 
)
inline

Insert another sequence into this one.

Parameters
idxindex where the sequence will be inserted
arraypointer to the first object to be inserted
arraySizenumber of objects to be inserted

Definition at line 465 of file Vector.h.

◆ insert() [5/5]

template<typename T>
void utl::Vector< T >::insert ( size_t  idx,
std::initializer_list< T >  list 
)
inline

Insert another sequence into this one.

Parameters
idxindex where the sequence will be inserted
listinitializer list

Definition at line 477 of file Vector.h.

◆ remove()

template<typename T >
void utl::Vector< T >::remove ( size_t  idx,
size_t  num 
)

Remove objects from the sequence.

Parameters
idxindex of first object to be removed
numnumber of objects to remove

Definition at line 1099 of file Vector.h.

◆ relocate()

template<typename T >
void utl::Vector< T >::relocate ( size_t  destIdx,
size_t  srcIdx 
)

Relocate one object within the sequence.

Parameters
destIdxindex of object that will immediately follow the relocated object
srcIdxindex of object to be relocated

Definition at line 1123 of file Vector.h.

◆ reverse()

template<typename T >
void utl::Vector< T >::reverse ( size_t  idx,
size_t  num 
)

Reverse the order of the objects in the sequence.

Parameters
idxindex of to-be-reversed section
numlength of to-be-reversed section

Definition at line 1174 of file Vector.h.

◆ set() [1/5]

template<typename T>
void utl::Vector< T >::set ( T *  array,
size_t  size 
)
inline

clear(), then set the given array/size.

The owner flag is preserved.

Parameters
arraynew allocation
sizesize of new sequence

Definition at line 510 of file Vector.h.

◆ set() [2/5]

template<typename T>
void utl::Vector< T >::set ( T *  array,
size_t  size,
bool  owner,
size_t  increment 
)

clear(), then set the given array/size and owner flag.

Parameters
arraynew array
sizesize of new array
ownernew owner flag
incrementgrowth increment

Definition at line 1189 of file Vector.h.

◆ set() [3/5]

template<typename T>
void utl::Vector< T >::set ( const T &  val)
inline

Assign val to all objects in the sequence.

Definition at line 526 of file Vector.h.

◆ set() [4/5]

template<typename T>
void utl::Vector< T >::set ( size_t  idx,
size_t  num,
const T &  val 
)

Assign a value to objects in the sequence.

Parameters
idxindex of first object to set = val
numnumber of consecutive objects to set
valvalue to assign

Definition at line 1203 of file Vector.h.

◆ set() [5/5]

template<typename T>
void utl::Vector< T >::set ( size_t  idx,
const T &  val 
)
inline

Set the value of the object at the given index.

Parameters
idxindex of object
valnew value for object at idx

Definition at line 545 of file Vector.h.

◆ setIncrement()

template<typename T>
void utl::Vector< T >::setIncrement ( size_t  increment)
inline

Set the growth increment.

Definition at line 553 of file Vector.h.

◆ swap()

template<typename T >
void utl::Vector< T >::swap ( size_t  i,
size_t  j 
)
inline

Swap the objects at the given indexes.

Definition at line 1216 of file Vector.h.

◆ operator[]() [1/4]

template<typename T>
T& utl::Vector< T >::operator[] ( size_t  idx)
inline

Array access operator.

Returns
reference to object at given index
Parameters
idxindex of requested object

Definition at line 576 of file Vector.h.

◆ operator[]() [2/4]

template<typename T>
const T& utl::Vector< T >::operator[] ( size_t  idx) const
inline

Array access operator.

Returns
reference to object at given index
Parameters
idxindex of requested object

Definition at line 587 of file Vector.h.

◆ operator[]() [3/4]

template<typename T>
T& utl::Vector< T >::operator[] ( int  idx)
inline

Same as above, but takes an int parameter.

Definition at line 594 of file Vector.h.

◆ operator[]() [4/4]

template<typename T>
const T& utl::Vector< T >::operator[] ( int  idx) const
inline

Same as above, but takes an int parameter.

Definition at line 600 of file Vector.h.

◆ operator const T *() [1/2]

template<typename T>
utl::Vector< T >::operator const T * ( ) const
inline

Conversion to const T*.

Definition at line 620 of file Vector.h.

◆ operator const T *() [2/2]

template<typename T>
utl::Vector< T >::operator const T * ( )
inline

Conversion to const T*.

Definition at line 626 of file Vector.h.

◆ operator T*()

template<typename T>
utl::Vector< T >::operator T* ( )
inline

Conversion to T*.

Definition at line 632 of file Vector.h.

◆ operator const void *() [1/2]

template<typename T>
utl::Vector< T >::operator const void * ( ) const
inline

Conversion to const void*.

Definition at line 638 of file Vector.h.

◆ operator const void *() [2/2]

template<typename T>
utl::Vector< T >::operator const void * ( )
inline

Conversion to const void*.

Definition at line 644 of file Vector.h.

◆ operator void *()

template<typename T>
utl::Vector< T >::operator void * ( )
inline

Conversion to void*.

Definition at line 650 of file Vector.h.

◆ operator+() [1/4]

template<typename T>
T* utl::Vector< T >::operator+ ( ssize_t  n)
inline

Pointer addition (ssize_t argument).

Definition at line 656 of file Vector.h.

◆ operator+() [2/4]

template<typename T>
const T* utl::Vector< T >::operator+ ( ssize_t  n) const
inline

Pointer addition (ssize_t argument).

Definition at line 664 of file Vector.h.

◆ operator+() [3/4]

template<typename T>
T* utl::Vector< T >::operator+ ( size_t  n)
inline

Pointer addition (size_t argument).

Definition at line 672 of file Vector.h.

◆ operator+() [4/4]

template<typename T>
const T* utl::Vector< T >::operator+ ( size_t  n) const
inline

Pointer addition (size_t argument).

Definition at line 679 of file Vector.h.


The documentation for this class was generated from the following files: