Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
vector< T > Class Template Referenceabstract

vector is a base class implementing an array of elements It cannot be instantiated on it's own since it's missing the mechanism for allocating the memory required by the vector More...

#include <ds_types_vector.h>

Inheritance diagram for vector< T >:
[legend]

Public Member Functions

 vector ()
 Creates an empty vector.
 
 vector (const vector &rhs)=delete
 
void clear (void)
 Clears all the elements of the vector.
 
size_t capacity (void) const
 Returns the capacity of the vector.
 
size_t size (void) const
 Returns the number of elements in the vector.
 
const T * data (void) const
 Returns the pointer to the C array underlying the vector.
 
T * data (void)
 Returns the pointer to the C array underlying the vector.
 
T & operator[] (size_t pos)
 Access operator [].
 
int32_t find (const T &value)
 Searches for the first element matching the specified value.
 
int32_t find (const lambda< bool(const T &item)> &equals)
 Searches for the first element matching the specified value. Uses a lambda to perform the matching.
 
void append (const T &item)
 Appends an element at the end of the vector.
 
void append (const T &item, size_t count)
 Appends an element one or more times at the end of the vector.
 
void append (const vector< T > &items)
 Appends the elements from the supplied vector at the end of the current vector.
 
void append (const vector< T > &items, size_t count)
 Appends a number of elements from the supplied vector at the end of the current vector.
 
void insert (const T &item, size_t pos)
 Inserts an element at a specified position in the vector.
 
void insert (const T &item, size_t count, size_t pos)
 Inserts an element one or more times at a specified position in the vector.
 
void insert (const vector< T > &items, size_t pos)
 Inserts the elements from the supplied vector at a specified position in the vector.
 
void insert (const vector< T > &items, size_t count, size_t pos)
 Inserts a number of elements from the supplied vector at a specified position in the vector.
 
void insert (const T *items, size_t count, size_t pos)
 Inserts the elements from the supplied C array at a specified position in the vector.
 
void erase (size_t pos, size_t count)
 Erases elements from the vector.
 

Protected Member Functions

virtual T * getMemory (void)=0
 
virtual size_t getCapacity (void) const =0
 

Protected Attributes

T * mArray
 
size_t mCapacity
 

Detailed Description

template<typename T>
class vector< T >

vector is a base class implementing an array of elements It cannot be instantiated on it's own since it's missing the mechanism for allocating the memory required by the vector

Member Function Documentation

◆ append() [1/4]

template<typename T >
void vector< T >::append ( const T &  item)
inline

Appends an element at the end of the vector.

Parameters
itemItem to append

◆ append() [2/4]

template<typename T >
void vector< T >::append ( const T &  item,
size_t  count 
)
inline

Appends an element one or more times at the end of the vector.

Parameters
itemItem to append
countNumber of times to append the element

◆ append() [3/4]

template<typename T >
void vector< T >::append ( const vector< T > &  items)
inline

Appends the elements from the supplied vector at the end of the current vector.

Parameters
itemsVector containing the elements to append

◆ append() [4/4]

template<typename T >
void vector< T >::append ( const vector< T > &  items,
size_t  count 
)
inline

Appends a number of elements from the supplied vector at the end of the current vector.

Parameters
itemsVector containing the source elements
countMaximum number of source elements to append

◆ capacity()

template<typename T >
size_t vector< T >::capacity ( void  ) const
inline

Returns the capacity of the vector.

Returns
Number of elements the vector can store

◆ data() [1/2]

template<typename T >
T * vector< T >::data ( void  )
inline

Returns the pointer to the C array underlying the vector.

Returns
Pointer to the C array of the vector

◆ data() [2/2]

template<typename T >
const T * vector< T >::data ( void  ) const
inline

Returns the pointer to the C array underlying the vector.

Returns
Pointer to the C array of the vector

◆ erase()

template<typename T >
void vector< T >::erase ( size_t  pos,
size_t  count 
)
inline

Erases elements from the vector.

Parameters
posPosition to remove elements from
countNumber of elements to remove from the specified position

◆ find() [1/2]

template<typename T >
int32_t vector< T >::find ( const lambda< bool(const T &item)> &  equals)
inline

Searches for the first element matching the specified value. Uses a lambda to perform the matching.

Parameters
equalsLambda that returns true if the element "item" is the one looking for
Returns
Index of the element if found or -1 if the element was not found

◆ find() [2/2]

template<typename T >
int32_t vector< T >::find ( const T &  value)
inline

Searches for the first element matching the specified value.

Parameters
valueElement to search for
Returns
Index of the element if found or -1 if the element was not found

◆ insert() [1/5]

template<typename T >
void vector< T >::insert ( const T &  item,
size_t  count,
size_t  pos 
)
inline

Inserts an element one or more times at a specified position in the vector.

Parameters
itemItem to append
countNumber of times to insert the element
posPosition to insert at

◆ insert() [2/5]

template<typename T >
void vector< T >::insert ( const T &  item,
size_t  pos 
)
inline

Inserts an element at a specified position in the vector.

Parameters
itemItem to append
posPosition to insert at

◆ insert() [3/5]

template<typename T >
void vector< T >::insert ( const T *  items,
size_t  count,
size_t  pos 
)
inline

Inserts the elements from the supplied C array at a specified position in the vector.

Parameters
itemsC array containing the source elements
countNumber of source elements to insert
posPosition to insert at

◆ insert() [4/5]

template<typename T >
void vector< T >::insert ( const vector< T > &  items,
size_t  count,
size_t  pos 
)
inline

Inserts a number of elements from the supplied vector at a specified position in the vector.

Parameters
itemsVector containing the source elements
countMaximum number of source elements to insert
posPosition to insert at

◆ insert() [5/5]

template<typename T >
void vector< T >::insert ( const vector< T > &  items,
size_t  pos 
)
inline

Inserts the elements from the supplied vector at a specified position in the vector.

Parameters
itemsVector containing the source elements
posPosition to insert at

◆ operator[]()

template<typename T >
T & vector< T >::operator[] ( size_t  pos)
inline

Access operator [].

Parameters
posIndex of the element to access
Returns
Reference T& to the element at position "pos"

◆ size()

template<typename T >
size_t vector< T >::size ( void  ) const
inline

Returns the number of elements in the vector.

Returns
Number of elements in the vector

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