|
Itasca C++ Interface
|
#include <farray.h>
Public Member Functions | |
| constexpr | FArray () |
| Default constructor - the array size is zero. | |
| ~FArray () | |
| Destructor. | |
| constexpr const FArray< T, S, uint64 > & | operator= (const FArray< T, S, uint64 > &f) |
| bool | operator== (const FArray< T, S2, uint64 > &f) const |
| uint64 | size () const |
| size_type | stackSize () const |
| Returns the size of the array pre-allocated on the stack. | |
| size_type | allocated () const |
| bool | empty () const |
| T * | data () |
| T & | front () |
| T & | back () |
| uint64 | find (const T &t) const |
| size_type | capacity () const |
| void | push_back (const T &t) |
| Adds a new element to the end of the array, increasing the array size by one. | |
| T * | emplace_back () |
| T * | emplace_n_back (size_type n) |
| void | pop_back () |
| Removes the last element in the array. The results are undefined if the array is of zero length. | |
| void | resize (uint64 i, const T &t=T()) |
| iterator | insert (uint64 i, const T &t) |
| void | put (uint64 i, const T &t) |
| Adds a value to the array, first making certain it is big enough to hold it. | |
| void | append (const C &in) |
| Appends the contents of one FArray onto another. | |
| bool | remove (uint64 i) |
| size_type | removeAll (const T &t) |
| void | clear () |
| void | reset () |
| void | reserve (size_type s) |
| void | clip () |
| iterator | begin () |
| const_iterator | constBegin () const |
| iterator | end () |
| const_iterator | constEnd () const |
| T & | at (uint64 i) |
| T & | operator[] (uint64 i) |
| T | value (uint64 i, const T &t={}) const |
Public Attributes | |
| T * | start_ |
| std::array< T, S > | arr_ |
| char | buffer [sizeof(T) *S] |
Template specialization for S=0 - indication no stack space at all should be made. MOO NOTE: THere is no reason to use this any more, as a std::vector will leave the capacity unchanged which was the primary reason to use this.
|
inline |
|
inline |
| void FArray< T, S, uint64 >::clear | ( | ) |
Resets the array size to zero, destroying all current elements. The allocated length is not changed.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
To avoid creating a temporary object, can call this to get memory location of new lcoation at end of stack and then use it to do an in-place new. new(fa.emplace_back()) Fred(arg1,arg2);
emplace_n_back: make sure n new positions are allocated and return a pointer to the first of those positions; caller should create objects at those positions.
|
inline |
| uint64 FArray< T, S, uint64 >::find | ( | const T & | t | ) | const |
Searches the array to find the first element matching t. Returns the index found, or limits<size_type>::max() if not found. This search is linear time.
|
inline |
| FArray< T, S, uint64 >::iterator FArray< T, S, uint64 >::insert | ( | uint64 | i, |
| const T & | t ) |
Inserts a value into the array at position i (the new position it will occupy). If I is past the end of the array, adds to end.
|
inline |
| bool FArray< T, S, uint64 >::remove | ( | uint64 | i | ) |
Removes a value from the array at position i If i is past the end of the array, does nothing.
| FArray< T, S, uint64 >::size_type FArray< T, S, uint64 >::removeAll | ( | const T & | t | ) |
Removes all values from the array matching t (operator==). Returns the number of objects removed
| void FArray< T, S, uint64 >::reset | ( | ) |
Resets the array size to zero, destroying all current elements. The allocated length is reset back to the stack length, and any heap memory is returned.
| void FArray< T, S, uint64 >::resize | ( | uint64 | i, |
| const T & | t = T() ) |
| i | The new array length. |
| t | The value assigned to new array elements (if any). Changes the actual length (not the allocated length) of the array to i. May increase the allocated length, but will not decrease it. |
|
inline |
|
inline |