Template Class Array

Class Documentation

template<typename T>
class Array

Simple DLL-safe array of objects.

Simple array type used to pass arrays of objects across the DLL boundary.

Template Parameters

T – : Object type to store in the array

Public Functions

inline Array()

Constructs an array with 0 elements.

inline explicit Array(const size_t Size)

Constructs an array with the given number of elements.

Each element in the array will have it’s default constuctor called.

Parameters

Size – const size_t : Number of elements in the array

inline Array(const T *Buffer, size_t Size)

Constructs an array from a buffer.

Parameters
  • Buffer – const T* : Pointer to the beginning of the buffer

  • Size – size_t : Number of elements in the buffer

inline Array(const Array<T> &Other)

Copy constructor.

Parameters

Other – const Array<T>& Other

inline Array(std::initializer_list<T> List)

Constructs an array from an initializer_list.

Parameters

List – std::initializer_list : Elements to construct the array from

inline ~Array()

Destructor.

Frees array memory.

inline T *Data()

Returns a pointer to the start of the array.

Returns

T*

inline const T *Data() const

Returns a const pointer to the start of the array.

Returns

const T*

inline Array<T> &operator=(const Array<T> &Other)

Copy assignment.

Parameters

Other – const Array<T>&

Returns

Array<T>&

inline T &operator[](const size_t Index)

Returns an element at the given index of the array.

Parameters

Index – const size_t : Element index to access

Returns

T& : Array element

inline const T &operator[](const size_t Index) const

Returns a const element at the given index of the array.

Parameters

Index – const size_t : Element index to access

Returns

const T& : Array element

inline const size_t Size() const

Returns the number of elements in the array.

Returns

const size_t

inline bool IsEmpty() const

Checks if the array has any elements.

Returns

bool

inline List<T> ToList() const

Returns a copy of this Array as a List.

Returns

List<T>