Namespace: Rx – Class: CRxArray – Header: Rx.Core/RxArray.h

CRxArray Class

C++
#include "Rx.Core/RxArray.h"

template<typename TValue>
class CRxArray : public IMemory

Generic array class.

Template Parameters

TValue

Generic type parameter.

Constructors

CRxArray()

Default constructor. Creates an empty array.

CRxArray(nElementCount)

Constructor. Creates a new array with the given number of default-constructed elements.

CRxArray(nElementCount, tInitValue)

Constructor. Constructs a new array with nElementCount copies of elements with value tInitValue.

CRxArray(xArray)

Copy constructor. Creates a copy of the given array.

CRxArray(xArray)

Move constructor.

CRxArray(pvInternal, bMove)

Creates a new array by moving or copying the internal data into this array.

Destructor

~CRxArray()

Destructs the array.

Methods

Assign(nElementCount, tInitValue)

Replaces the contents with nElementCount copies of value tInitValue.

At(nIndex)

Returns a reference to the element at the specified index, with bounds checking. If nIndex is not within the range of the array, an exception is thrown.

At(nIndex)

Returns a reference to the element at the specified index, with bounds checking. If nIndex is not within the range of the array, an exception is thrown.

Front()

Returns a reference to the first element in the array. Calling Front on an empty array is undefined.

Front()

Returns a reference to the first element in the array. Calling Front on an empty array is undefined.

Back()

Returns a reference to the last element in the array. Calling Back on an empty array is undefined.

Back()

Returns a reference to the last element in the array. Calling Back on an empty array is undefined.

IsEmpty()

Checks if the array has no elements.

Size()

Returns the number of elements in the array.

Reserve(nNewElementCount)

Increase the capacity of the array to a value that's greater or equal to nNewElementCount. If nNewElementCount is greater than the current capacity, new storage is allocated, otherwise the method does nothing.

Capacity()

Returns the number of elements that the array has currently allocated space for.

ShrinkToFit()

Requests the removal of unused capacity.

Clear()

Removes all elements from the array.

Insert(nPosition, tValue)

Inserts elements at the specified location in the array.

Insert(nPosition, tValue)

Inserts elements at the specified location in the array.

Insert(nPosition, nCount, tValue)

Inserts nCount copies of tValue at the specified location in the array.

Erase(nPosition)

Removes the element at the given position from the array.

Erase(nPosition, nCount)

Removes specified elements from the array.

PushBack(tValue)

Appends the given element value to the end of the array. The new element is initialized as a copy of tValue.

PushBack(tValue)

Appends the given element value to the end of the array. The value is moved into the new element.

PopBack()

Removes the last element of the array. Calling PopBack on an empty array is undefined.

Resize(nNewElementCount, tValue)

Resizes the array to contain count elements.

Swap(xArray)

Exchanges the contents of the array with those of xArray. Does not invoke any move, copy, or swap operations on individual elements.

CopyIntoInternal(pvInternal)

Copies this array into the internal data.

CopyFromInternal(pvInternal)

Creates a new array by copying the internal data into this array.

MoveIntoInternal(pvInternal)

moves this array into the internal data. This array is empty afterwards.

MoveFromInternal(pvInternal)

Creates a new array by moving the internal data into this array.

begin()

Returns an iterator (pointer) to the first element of the array.

begin()

Returns an iterator (pointer) to the first element of the array.

end()

Returns an iterator (pointer) to the element following the last element of the array. This element acts as a placeholder; attempting to access it results in undefined behavior.

end()

Returns an iterator (pointer) to the element following the last element of the array. This element acts as a placeholder; attempting to access it results in undefined behavior.

Data()

Gets the pointer to the internal data.

Data()

Gets the pointer to the internal data.

New(nNewElementCount)

Resizes the array to contain count elements.

Resize(nNewElementCount)

Resizes the array to contain count elements.

Delete()

Removes all elements from the array.

Reset()

Sets the internal memory to zeros.

CopyFrom(pxSrcMemory)

Copies the content of the given source memory into this array. Sets the size of this array to the size of the memory.

GetPointer()

Gets the pointer to the internal data.

GetPointer()

Gets the pointer to the internal data.

GetElementSize()

Gets the size of a single value in this array.

Length()

Gets the number of elements in this array.

IsValid()

Query if this object is valid. Returns always true.

Operators

operator=(xArray)

Copy assignment operator. Replaces the contents with a copy of the contents of the given array.

operator=(xArray)

Move assignment operator. Replaces the contents with those of the given array using move semantics (i.e. the data in the given array is moved into this array). The given array is in a valid but unspecified state afterwards.

operator[](nIndex)

Returns a reference to the element at the specified index. No bounds checking is performed.

operator[](nIndex)

Returns a reference to the element at the specified index. No bounds checking is performed.