EHS
ehs::Array< T, N > Class Template Reference

#include <Array.h>

Public Member Functions

 ~Array ()
 Frees any data created on the heap. More...
 
 Array ()
 Default members initialization. More...
 
 Array (const N size)
 
 Array (std::initializer_list< T > list)
 
 Array (const T *const data, const N size)
 
 Array (Array &&array) noexcept
 
 Array (const Array &array)
 
Array< T, N > & operator= (Array &&array) noexcept
 
Array< T, N > & operator= (const Array &array)
 
Arrayoperator= (std::initializer_list< T > list)
 
Arrayoperator+= (Array value)
 
bool operator== (const Array &in) const
 
bool operator!= (const Array &in) const
 
Arrayoperator+= (std::initializer_list< T > value)
 
Arrayoperator+= (const T value)
 
 operator T* () const
 Retrieves the raw C-style array from casting an array object. More...
 
void Swap (N a, N b) const
 
void Insert (const N index, const T value)
 
Remove (const N index)
 
void Push (const T *const value, const N size)
 
void Push (Array value)
 
void Push (std::initializer_list< T > value)
 
void Push (T value)
 
Pop ()
 
Pop (const N index)
 
void Clear ()
 Releases the resources of the array. More...
 
void Resize (const N newSize)
 
Size () const
 
End () const
 

Protected Attributes

T * data
 
size
 

Detailed Description

template<typename T, typename N = UInt_64>
class ehs::Array< T, N >

A helper class for C-style arrays.

Template Parameters
TArray data type to use.
NNumber data type to use.

Constructor & Destructor Documentation

◆ ~Array()

template<typename T , typename N = UInt_64>
ehs::Array< T, N >::~Array ( )
inline

Frees any data created on the heap.

◆ Array() [1/6]

template<typename T , typename N = UInt_64>
ehs::Array< T, N >::Array ( )
inline

Default members initialization.

◆ Array() [2/6]

template<typename T , typename N = UInt_64>
ehs::Array< T, N >::Array ( const N  size)
inlineexplicit

Initializes an empty array with the given size.

Note
Data must be assigned manually using an index.

◆ Array() [3/6]

template<typename T , typename N = UInt_64>
ehs::Array< T, N >::Array ( std::initializer_list< T >  list)
inline

Initializes this array with an initializer list object.

Parameters
[in]listThe given initializer list.

◆ Array() [4/6]

template<typename T , typename N = UInt_64>
ehs::Array< T, N >::Array ( const T *const  data,
const N  size 
)
inline

Initializes members with given C-style array.

Parameters
[in]dataThe C-style array.
[in]sizeThe size of the given C-style array.

◆ Array() [5/6]

template<typename T , typename N = UInt_64>
ehs::Array< T, N >::Array ( Array< T, N > &&  array)
inlinenoexcept

◆ Array() [6/6]

template<typename T , typename N = UInt_64>
ehs::Array< T, N >::Array ( const Array< T, N > &  array)
inline

Copies all members from the given array object.

Parameters
[in]arrayThe array object to copy from.

Member Function Documentation

◆ Clear()

template<typename T , typename N = UInt_64>
void ehs::Array< T, N >::Clear ( )
inline

Releases the resources of the array.

◆ End()

template<typename T , typename N = UInt_64>
N ehs::Array< T, N >::End ( ) const
inline

Retrieves the index at the end of the array.

Returns
The index.

◆ Insert()

template<typename T , typename N = UInt_64>
void ehs::Array< T, N >::Insert ( const N  index,
const T  value 
)
inline

Inserts a value at the specified index.

Parameters
[in]indexThe index to insert the value at.
[in]valueThe value to add.

◆ operator T*()

template<typename T , typename N = UInt_64>
ehs::Array< T, N >::operator T* ( ) const
inline

Retrieves the raw C-style array from casting an array object.

◆ operator!=()

template<typename T , typename N = UInt_64>
bool ehs::Array< T, N >::operator!= ( const Array< T, N > &  in) const
inline

◆ operator+=() [1/3]

template<typename T , typename N = UInt_64>
Array & ehs::Array< T, N >::operator+= ( Array< T, N >  value)
inline

Adds a given array object at the end of the array.

Parameters
[in]valueThe given array object to push to the end of the array.

◆ operator+=() [2/3]

template<typename T , typename N = UInt_64>
Array & ehs::Array< T, N >::operator+= ( const T  value)
inline

Adds a given value at the end of the array.

Parameters
[in]valueThe given value to push to the end of the array.

◆ operator+=() [3/3]

template<typename T , typename N = UInt_64>
Array & ehs::Array< T, N >::operator+= ( std::initializer_list< T >  value)
inline

Adds a given array object at the end of the array.

Parameters
[in]valueThe given initializer list to push to the end of the array.

◆ operator=() [1/3]

template<typename T , typename N = UInt_64>
Array< T, N > & ehs::Array< T, N >::operator= ( Array< T, N > &&  array)
inlinenoexcept

◆ operator=() [2/3]

template<typename T , typename N = UInt_64>
Array< T, N > & ehs::Array< T, N >::operator= ( const Array< T, N > &  array)
inline

Copies all members from the given array object.

Parameters
[in]arrayThe array object to copy from.
Returns
The array that has been assigned to.

◆ operator=() [3/3]

template<typename T , typename N = UInt_64>
Array & ehs::Array< T, N >::operator= ( std::initializer_list< T >  list)
inline

Copies all members from the given initializer list object.

Parameters
[in]listThe initializer list object to copy from.
Returns
The array that has been assigned to.

◆ operator==()

template<typename T , typename N = UInt_64>
bool ehs::Array< T, N >::operator== ( const Array< T, N > &  in) const
inline

◆ Pop() [1/2]

template<typename T , typename N = UInt_64>
T ehs::Array< T, N >::Pop ( )
inline

Removes a value at the end of the array.

Returns
The value that was popped.

◆ Pop() [2/2]

template<typename T , typename N = UInt_64>
T ehs::Array< T, N >::Pop ( const N  index)
inline

Will swap the value at the given index with the value at the end of the array and pops it.

Parameters
[in]indexThe index of the value to swap with.
Returns
The removed value.

◆ Push() [1/4]

template<typename T , typename N = UInt_64>
void ehs::Array< T, N >::Push ( Array< T, N >  value)
inline

Adds a given array object at the end of the array.

Parameters
[in]valueThe given array object to push to the end of the array.

◆ Push() [2/4]

template<typename T , typename N = UInt_64>
void ehs::Array< T, N >::Push ( const T *const  value,
const N  size 
)
inline

Adds a given C-style array at the end of the array.

Parameters
[in]valueThe given C-style array to push to the end of the array.
[in]sizeThe size of the given C-style array.

◆ Push() [3/4]

template<typename T , typename N = UInt_64>
void ehs::Array< T, N >::Push ( std::initializer_list< T >  value)
inline

Adds a given array object at the end of the array.

Parameters
[in]valueThe given initializer list to push to the end of the array.

◆ Push() [4/4]

template<typename T , typename N = UInt_64>
void ehs::Array< T, N >::Push ( value)
inline

Adds a given value at the end of the array.

Parameters
[in]valueThe given value to push to the end of the array.

◆ Remove()

template<typename T , typename N = UInt_64>
T ehs::Array< T, N >::Remove ( const N  index)
inline

Removes a value at the specified index.

Parameters
[in]indexThe index to remove a value.
Returns
The value that was removed.

◆ Resize()

template<typename T , typename N = UInt_64>
void ehs::Array< T, N >::Resize ( const N  newSize)
inline

Resizes the array.

Parameters
[in]newSizeThe size to change to.

◆ Size()

template<typename T , typename N = UInt_64>
N ehs::Array< T, N >::Size ( ) const
inline

Retrieves the size of the array.

Returns
The resulting size.

◆ Swap()

template<typename T , typename N = UInt_64>
void ehs::Array< T, N >::Swap ( a,
b 
) const
inline

Swaps two values in the array.

Parameters
aThe first index to swap with.
bThe second index to swap with.

Member Data Documentation

◆ data

template<typename T , typename N = UInt_64>
T* ehs::Array< T, N >::data
protected

◆ size

template<typename T , typename N = UInt_64>
N ehs::Array< T, N >::size
protected

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