Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
StaticArray< T, N > Class Template Reference

Simple variable length array backed by a fixed size buffer. More...

#include <StaticArray.h>

Inheritance diagram for StaticArray< T, N >:
EPAConvexHullBuilder::Points EPAConvexHullBuilder::TriangleQueue

Classes

struct  Storage
 

Public Types

using value_type = T
 
using size_type = uint
 
using const_iterator = const T *
 
using iterator = T *
 

Public Member Functions

 StaticArray ()=default
 Default constructor.
 
 StaticArray (std::initializer_list< T > inList)
 Constructor from initializer list.
 
 StaticArray (const StaticArray< T, N > &inRHS)
 Copy constructor.
 
 ~StaticArray ()
 Destruct all elements.
 
void clear ()
 Destruct all elements and set length to zero.
 
void push_back (const T &inElement)
 Add element to the back of the array.
 
template<class... A>
void emplace_back (A &&... inElement)
 Construct element at the back of the array.
 
void pop_back ()
 Remove element from the back of the array.
 
bool empty () const
 Returns true if there are no elements in the array.
 
size_type size () const
 Returns amount of elements in the array.
 
size_type capacity () const
 Returns maximum amount of elements the array can hold.
 
void resize (size_type inNewSize)
 Resize array to new length.
 
const_iterator begin () const
 Iterators.
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
const T * data () const
 
T * data ()
 
T & operator[] (size_type inIdx)
 Access element.
 
const T & operator[] (size_type inIdx) const
 
T & at (size_type inIdx)
 Access element.
 
const T & at (size_type inIdx) const
 
const T & front () const
 First element in the array.
 
T & front ()
 
const T & back () const
 Last element in the array.
 
T & back ()
 
void erase (const_iterator inIter)
 Remove one element from the array.
 
void erase (const_iterator inBegin, const_iterator inEnd)
 Remove multiple element from the array.
 
StaticArray< T, N > & operator= (const StaticArray< T, N > &inRHS)
 Assignment operator.
 
template<uint M>
StaticArray< T, N > & operator= (const StaticArray< T, M > &inRHS)
 Assignment operator with static array of different max length.
 
bool operator== (const StaticArray< T, N > &inRHS) const
 Comparing arrays.
 
bool operator!= (const StaticArray< T, N > &inRHS) const
 

Static Public Attributes

static constexpr uint Capacity = N
 

Protected Attributes

size_type mSize = 0
 
Storage mElements [N]
 

Detailed Description

template<class T, uint N>
class StaticArray< T, N >

Simple variable length array backed by a fixed size buffer.

Member Typedef Documentation

◆ const_iterator

template<class T , uint N>
using StaticArray< T, N >::const_iterator = const T *

◆ iterator

template<class T , uint N>
using StaticArray< T, N >::iterator = T *

◆ size_type

template<class T , uint N>
using StaticArray< T, N >::size_type = uint

◆ value_type

template<class T , uint N>
using StaticArray< T, N >::value_type = T

Constructor & Destructor Documentation

◆ StaticArray() [1/3]

template<class T , uint N>
StaticArray< T, N >::StaticArray ( )
default

Default constructor.

◆ StaticArray() [2/3]

template<class T , uint N>
StaticArray< T, N >::StaticArray ( std::initializer_list< T >  inList)
inlineexplicit

Constructor from initializer list.

◆ StaticArray() [3/3]

template<class T , uint N>
StaticArray< T, N >::StaticArray ( const StaticArray< T, N > &  inRHS)
inline

Copy constructor.

◆ ~StaticArray()

template<class T , uint N>
StaticArray< T, N >::~StaticArray ( )
inline

Destruct all elements.

Member Function Documentation

◆ at() [1/2]

template<class T , uint N>
T & StaticArray< T, N >::at ( size_type  inIdx)
inline

Access element.

◆ at() [2/2]

template<class T , uint N>
const T & StaticArray< T, N >::at ( size_type  inIdx) const
inline

◆ back() [1/2]

template<class T , uint N>
T & StaticArray< T, N >::back ( )
inline

◆ back() [2/2]

template<class T , uint N>
const T & StaticArray< T, N >::back ( ) const
inline

Last element in the array.

◆ begin() [1/2]

template<class T , uint N>
iterator StaticArray< T, N >::begin ( )
inline

◆ begin() [2/2]

template<class T , uint N>
const_iterator StaticArray< T, N >::begin ( ) const
inline

Iterators.

◆ capacity()

template<class T , uint N>
size_type StaticArray< T, N >::capacity ( ) const
inline

Returns maximum amount of elements the array can hold.

◆ clear()

template<class T , uint N>
void StaticArray< T, N >::clear ( )
inline

Destruct all elements and set length to zero.

◆ data() [1/2]

template<class T , uint N>
T * StaticArray< T, N >::data ( )
inline

◆ data() [2/2]

template<class T , uint N>
const T * StaticArray< T, N >::data ( ) const
inline

◆ emplace_back()

template<class T , uint N>
template<class... A>
void StaticArray< T, N >::emplace_back ( A &&...  inElement)
inline

Construct element at the back of the array.

◆ empty()

template<class T , uint N>
bool StaticArray< T, N >::empty ( ) const
inline

Returns true if there are no elements in the array.

◆ end() [1/2]

template<class T , uint N>
iterator StaticArray< T, N >::end ( )
inline

◆ end() [2/2]

template<class T , uint N>
const_iterator StaticArray< T, N >::end ( ) const
inline

◆ erase() [1/2]

template<class T , uint N>
void StaticArray< T, N >::erase ( const_iterator  inBegin,
const_iterator  inEnd 
)
inline

Remove multiple element from the array.

◆ erase() [2/2]

template<class T , uint N>
void StaticArray< T, N >::erase ( const_iterator  inIter)
inline

Remove one element from the array.

◆ front() [1/2]

template<class T , uint N>
T & StaticArray< T, N >::front ( )
inline

◆ front() [2/2]

template<class T , uint N>
const T & StaticArray< T, N >::front ( ) const
inline

First element in the array.

◆ operator!=()

template<class T , uint N>
bool StaticArray< T, N >::operator!= ( const StaticArray< T, N > &  inRHS) const
inline

◆ operator=() [1/2]

template<class T , uint N>
template<uint M>
StaticArray< T, N > & StaticArray< T, N >::operator= ( const StaticArray< T, M > &  inRHS)
inline

Assignment operator with static array of different max length.

◆ operator=() [2/2]

template<class T , uint N>
StaticArray< T, N > & StaticArray< T, N >::operator= ( const StaticArray< T, N > &  inRHS)
inline

Assignment operator.

◆ operator==()

template<class T , uint N>
bool StaticArray< T, N >::operator== ( const StaticArray< T, N > &  inRHS) const
inline

Comparing arrays.

◆ operator[]() [1/2]

template<class T , uint N>
T & StaticArray< T, N >::operator[] ( size_type  inIdx)
inline

Access element.

◆ operator[]() [2/2]

template<class T , uint N>
const T & StaticArray< T, N >::operator[] ( size_type  inIdx) const
inline

◆ pop_back()

template<class T , uint N>
void StaticArray< T, N >::pop_back ( )
inline

Remove element from the back of the array.

◆ push_back()

template<class T , uint N>
void StaticArray< T, N >::push_back ( const T &  inElement)
inline

Add element to the back of the array.

◆ resize()

template<class T , uint N>
void StaticArray< T, N >::resize ( size_type  inNewSize)
inline

Resize array to new length.

◆ size()

template<class T , uint N>
size_type StaticArray< T, N >::size ( ) const
inline

Returns amount of elements in the array.

Member Data Documentation

◆ Capacity

template<class T , uint N>
constexpr uint StaticArray< T, N >::Capacity = N
staticconstexpr

◆ mElements

template<class T , uint N>
Storage StaticArray< T, N >::mElements[N]
protected

◆ mSize

template<class T , uint N>
size_type StaticArray< T, N >::mSize = 0
protected

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