std::vector -equivalent. More...
#include <Array.h>
Public Member Functions | |
| size_t | size () const |
| size_t | capacity () const |
| void | set_allocator (AllocT *allocator_) |
| Sets the allocator used by this Array. | |
| AllocT * | get_allocator () const |
| const T * | beginptr () const |
| Pointer to the first element. | |
| const T * | endptr () const |
| Pointer to one past the last used element. | |
| const T * | capptr () const |
| Pointer to the first element beyond allocated memory. | |
| iterator | begin () |
| iterator | end () |
| const T * | end () const |
| void | insert (int i, const T &val) |
| Inserts an element before the ith element of the Array. Running time is O(n). | |
| bool | MembersUnique () const |
| Returns true if the members of this array all have distinct values. Tests each pair and runs in O(n^2). | |
| void | push_front (const T &val) |
| Inserts an element to the front of the Array. Running time is O(n). | |
| void | push_back (const T &val) |
| Inserts the given element to back of the Array. Running time is O(1). | |
| void | push_back_unsafe (const T &val) |
| Inserts the given element to back of the Array, but without doing bounds checking. | |
| T & | push_back_unsafe_pod () |
| Inserts an uninitialized value to the back of the Array, and returns a reference to it. | |
| T & | push_back () |
| Inserts a default-constructed element to back of the Array. Running time is O(1). | |
| void | erase (int start, int end) |
| Erases a range of elements, excluding the element at index end. | |
| void | erase (int i) |
| Removes the ith element from the array. Running time is O(n). | |
| void | erase (size_t i) |
| Removes the ith element from the array. Running time is O(n). | |
| void | pop_back () |
| Clears the last element of the array. Running time is O(1). | |
| void | pop_back_pod () |
| Clears the last element of the array. | |
| void | clear () |
| Removes all elements in the array. Running time is O(n). | |
| void | clear_pod () |
| Clears the whole Array by simply marking the size to 0. | |
| void | reserve (size_t newSize) |
| Enlarges the allocated memory area if it's not big enough to hold newSize elements. | |
std::vector -equivalent.
| size_t kNet::Array< T, AllocT >::size | ( | ) | const [inline] |
| size_t kNet::Array< T, AllocT >::capacity | ( | ) | const [inline] |
| AllocT* kNet::Array< T, AllocT >::get_allocator | ( | ) | const [inline] |
| iterator kNet::Array< T, AllocT >::begin | ( | ) | [inline] |
| iterator kNet::Array< T, AllocT >::end | ( | ) | [inline] |
| const T* kNet::Array< T, AllocT >::end | ( | ) | const [inline] |
| void kNet::Array< T, AllocT >::push_back_unsafe | ( | const T & | val | ) | [inline] |
| T& kNet::Array< T, AllocT >::push_back_unsafe_pod | ( | ) | [inline] |
Inserts an uninitialized value to the back of the Array, and returns a reference to it.
This function was implemented after profiling a code generation issue with VS2008 that resulted in suboptimal performance.
| void kNet::Array< T, AllocT >::erase | ( | int | start, | |
| int | end | |||
| ) | [inline] |
Erases a range of elements, excluding the element at index end.
That is, the interval [start, end[. Running time is O(n).
<
Referenced by kNet::Array< NetworkMessage * >::erase().
| void kNet::Array< T, AllocT >::erase | ( | size_t | i | ) | [inline] |
Removes the ith element from the array. Running time is O(n).
<
| void kNet::Array< T, AllocT >::pop_back | ( | ) | [inline] |
Clears the last element of the array. Running time is O(1).
<
| void kNet::Array< T, AllocT >::pop_back_pod | ( | ) | [inline] |
Clears the last element of the array.
Running time is O(1). Use for pod data that don't need to be cleared when uninitializing.
| void kNet::Array< T, AllocT >::clear | ( | ) | [inline] |
Removes all elements in the array. Running time is O(n).
<
| void kNet::Array< T, AllocT >::clear_pod | ( | ) | [inline] |
Clears the whole Array by simply marking the size to 0.
Running time is O(1). Only call this function if the element type is a POD that does not need its dtor to be called for cleanup.
| void kNet::Array< T, AllocT >::reserve | ( | size_t | newSize | ) | [inline] |
Enlarges the allocated memory area if it's not big enough to hold newSize elements.
\ todo
Referenced by kNet::Array< NetworkMessage * >::insert(), and kNet::Array< NetworkMessage * >::push_back().
1.7.1