#include <FMArray.h>
Public Types | |
typedef T * | iterator |
The basic list iterator. | |
typedef const T * | const_iterator |
The non-modifiable list iterator. | |
Public Member Functions | |
vector () | |
Default constructor. | |
vector (size_t size) | |
Constructor. | |
vector (size_t size, const T &defaultValue) | |
Constructor. | |
vector (const fm::vector< T, PRIMITIVE > ©) | |
Copy constructor. | |
vector (const T *values, size_t count) | |
Constructor. | |
~vector () | |
Destructor. | |
T ** | GetDataPtr () |
Retrieves a pointer to our internal buffer. | |
const T ** | GetDataPtr () const |
See above. | |
template<class Type2> | |
iterator | find (const Type2 &value) |
Retrieves an iterator for a given element. | |
template<class Type2> | |
const_iterator | find (const Type2 &value) const |
See above. | |
void | sort () |
Sorts this vector using the default comparisons operator. | |
void | sort (comparator< T > &comp) |
Sorts this vector using the given fm::comparator. | |
iterator | erase (iterator it) |
Removes the value at the given position within the list. | |
void | erase (iterator first, iterator last) |
Removes a range of values from the list. | |
void | erase (size_t first, size_t last) |
Removes a range of values from the list. | |
bool | erase (const T &value) |
Removes a value contained within the list, once. | |
void | erase (size_t index) |
Removes an indexed value contained within the list. | |
bool | contains (const T &value) const |
Retrieves whether the list contains a given value. | |
template<class V2, class V3> | |
void | replace (const V2 &oldValue, const V3 &newValue) |
Replaces all cases of one value into another value. | |
template<class V2, class V3> | |
void | replace (iterator start, iterator end, const V2 &oldValue, const V3 &newValue) |
Replaces the instances of one value into another value within a given segment of the list. | |
size_t | size () const |
Retrieves the number of values contained in the list. | |
bool | empty () const |
Retrieves whether there are any elements in the list. | |
void | resize (size_t count) |
Sets the number of values contained in the list. | |
void | resize (size_t count, const T &value) |
Sets the number of values contained in the list. | |
void | clear () |
Removes all the element in the list. | |
void | reserve (size_t count) |
Pre-allocate the list to a certain number of values. | |
size_t | capacity () |
Retrieves the maximum size the array can grow to without allocating memory size is always less than or equal to capacity. | |
size_t | capacity () const |
See above. | |
iterator | begin () |
Retrieves the iterator for the first value in the list. | |
const_iterator | begin () const |
See above. | |
iterator | end () |
Retrieves the iterator just past the last value in the list. | |
const_iterator | end () const |
See above. | |
iterator | insert (iterator it, const T &item) |
Inserts a new item at a given position within the list. | |
void | insert (size_t index, const T &item) |
Inserts a new item at a given position within the list. | |
void | push_back (const T &item) |
Inserts a new item at the end of the list. | |
void | push_front (const T &item) |
Inserts a new item at the front of the list. | |
void | pop_back () |
Removes the last item from a list. | |
void | pop_front () |
Removes the first item from a list. | |
template<typename _IT> | |
void | insert (iterator it, _IT first, _IT last) |
Inserts multiple items at a given position within the list. | |
void | insert (iterator it, size_t count, const T &item, bool noInit=false) |
Inserts one item, multiple times at a given position within the list. | |
void | insert (size_t index, size_t count, const T &value) |
Inserts one value, multiple times, to this list. | |
void | insert (iterator it, const T *first, size_t count) |
Inserts multiple items at a given position within the list, from a static list. | |
void | insert (size_t index, const T *values, size_t count) |
Inserts multiple values to this list. | |
T & | front () |
Retrieves the first element of the pointer array. | |
const T & | front () const |
See above. | |
T & | back () |
Retrieves the last element of the pointer array. | |
const T & | back () const |
See above. | |
T & | at (size_t index) |
Retrieves an indexed object in the pointer array. | |
const T & | at (size_t index) const |
See above. | |
template<class INTEGER> | |
T & | operator[] (INTEGER index) |
See above. | |
template<class INTEGER> | |
const T & | operator[] (INTEGER index) const |
See above. | |
bool | operator== (const fm::vector< T, PRIMITIVE > &other) const |
Retrieves whether two lists are equivalent. | |
vector< T, PRIMITIVE > & | operator= (const fm::vector< T, PRIMITIVE > &rhs) |
Copy operator. | |
Protected Attributes | |
size_t | reserved |
The capacity of the vector. | |
size_t | sized |
The number of values contained in the vector. | |
T * | heapBuffer |
The heap buffer that contains the values. |
Intentionally has an interface similar to the standard C++ vector class. It's implement should be very similar yet more lightweight.
We have also added useful extra functionality, such as a constructor that takes in a constant-sized array, comparison with a constant-sized array, erase and find functions that take in a value, etc.
|
Constructor. Builds a dynamically-sized array of the wanted size.
|
|
Constructor. Builds a dynamically-sized array of the wanted size.
|
|
Copy constructor.
|
|
Constructor. Builds a dynamically-sized array from a constant-sized array.
|
|
Retrieves an indexed object in the pointer array.
Reimplemented in fm::pvector< T >, FUObjectContainer< ObjectClass >, FUTrackedList< ObjectClass >, fm::pvector< FUPlugin >, fm::pvector< ObjectClass >, fm::pvector< FCDAnimated >, fm::pvector< _NODE >, fm::pvector< FCDPlaceHolder >, fm::pvector< FCDEntityReference >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Retrieves the last element of the pointer array.
Reimplemented in fm::pvector< T >, FUObjectContainer< ObjectClass >, fm::stringT< CH >, FUTrackedList< ObjectClass >, fm::pvector< FUPlugin >, fm::pvector< ObjectClass >, fm::pvector< FCDAnimated >, fm::pvector< _NODE >, fm::pvector< FCDPlaceHolder >, fm::pvector< FCDEntityReference >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Retrieves the iterator for the first value in the list.
Reimplemented in fm::pvector< T >, FUObjectContainer< ObjectClass >, FUTrackedList< ObjectClass >, fm::pvector< FUPlugin >, fm::pvector< ObjectClass >, fm::pvector< FCDAnimated >, fm::pvector< _NODE >, fm::pvector< FCDPlaceHolder >, fm::pvector< FCDEntityReference >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Retrieves the maximum size the array can grow to without allocating memory size is always less than or equal to capacity.
|
|
Retrieves whether the list contains a given value.
|
|
Retrieves the iterator just past the last value in the list.
Reimplemented in fm::pvector< T >, FUObjectContainer< ObjectClass >, FUTrackedList< ObjectClass >, fm::pvector< FUPlugin >, fm::pvector< ObjectClass >, fm::pvector< FCDAnimated >, fm::pvector< _NODE >, fm::pvector< FCDPlaceHolder >, fm::pvector< FCDEntityReference >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Removes an indexed value contained within the list.
Reimplemented in fm::pvector< T >, FUObjectContainer< ObjectClass >, FUTrackedList< ObjectClass >, fm::pvector< FUPlugin >, fm::pvector< ObjectClass >, fm::pvector< FCDAnimated >, fm::pvector< _NODE >, fm::pvector< FCDPlaceHolder >, fm::pvector< FCDEntityReference >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Removes a value contained within the list, once.
|
|
Removes a range of values from the list.
Reimplemented in FUObjectContainer< ObjectClass >, fm::stringT< CH >, FUTrackedList< ObjectClass >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Removes a range of values from the list. The range is determined as every value between and including the first value, up to the last value, but not including the last value.
|
|
Removes the value at the given position within the list.
|
|
Retrieves an iterator for a given element.
|
|
Retrieves the first element of the pointer array.
Reimplemented in fm::pvector< T >, FUObjectContainer< ObjectClass >, FUTrackedList< ObjectClass >, fm::pvector< FUPlugin >, fm::pvector< ObjectClass >, fm::pvector< FCDAnimated >, fm::pvector< _NODE >, fm::pvector< FCDPlaceHolder >, fm::pvector< FCDEntityReference >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Retrieves a pointer to our internal buffer. Be very careful when using this.
|
|
Inserts multiple values to this list.
Reimplemented in fm::stringT< CH >. |
|
Inserts multiple items at a given position within the list, from a static list.
|
|
Inserts one value, multiple times, to this list.
|
|
Inserts one item, multiple times at a given position within the list.
|
|
Inserts multiple items at a given position within the list.
|
|
Inserts a new item at a given position within the list.
|
|
Inserts a new item at a given position within the list.
|
|
Copy operator. Copies the contents of one vector to another.
|
|
Retrieves whether two lists are equivalent.
|
|
Removes the first item from a list. This operation is very expansive and not recommended for real-time operations. Reimplemented in FUObjectContainer< ObjectClass >, FUTrackedList< ObjectClass >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Inserts a new item at the end of the list.
|
|
Inserts a new item at the front of the list. This operation is very expansive and not recommended for real-time operations.
|
|
Replaces the instances of one value into another value within a given segment of the list.
|
|
Replaces all cases of one value into another value.
|
|
Pre-allocate the list to a certain number of values. You can use reserve zero values in order to clear the memory used by this list. This function is useful when optimizing.
Reimplemented in FUObjectContainer< ObjectClass >, FUTrackedList< ObjectClass >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Sets the number of values contained in the list.
Reimplemented in fm::stringT< CH >. |
|
Sets the number of values contained in the list.
Reimplemented in fm::pvector< T >, fm::stringT< CH >, fm::pvector< FUPlugin >, fm::pvector< ObjectClass >, fm::pvector< FCDAnimated >, fm::pvector< _NODE >, fm::pvector< FCDPlaceHolder >, and fm::pvector< FCDEntityReference >. |
|
Retrieves the number of values contained in the list.
Reimplemented in FUObjectContainer< ObjectClass >, fm::stringT< CH >, FUTrackedList< ObjectClass >, FUObjectContainer< FUPlugin >, FUObjectContainer< FCDAnimated >, FUObjectContainer< FCDPlaceHolder >, and FUTrackedList< FCDEntityReference >. |
|
Sorts this vector using the given fm::comparator.
|