C4 Engine
C4 Engine API Documentation

Array::SetArrayElementCount

Defined in:  TSArray.h
Sets the current size of an array.
Prototype

void SetArrayElementCount(int32 count);

void SetArrayElementCount(int32 count, const type& init);

Parameters
count The new size of the array.
init A reference to an object that is used to copy-construct new objects in the array.
Description
The SetArrayElementCount function sets the number of objects currently stored in an array. If count is greater than the current size of the array, then space is allocated for count objects and each new object is copy-constructed from the value of the init parameter. If count is less than the current size of the array, then the logical size of the array is reduced, and each object beyond the new size of the array is destroyed in reverse order.

If the init parameter is omitted, then any new objects created are default-constructed if the type of object stored in the array is a non-POD type. If the type of object stored in the array is a POD type, then any new objects created are left uninitialized.
See Also

Array::GetArrayElementCount

Array::AppendArrayElement

Array::InsertArrayElement

Array::RemoveArrayElement

Array::RemoveLastArrayElement