C4 Engine Terathon Software C4 Engine API Documentation

• Utility Library

API Links
Developer Links

Array::SetElementCount

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

void SetElementCount(int32 count, const type *init = nullptr);

Parameters
count The new size of the array.
init A pointer to an object that is used to construct new objects in the array. If this is nullptr, then new objects are default-constructed. Otherwise, new objects are copy-constructed using a reference to the object to which init points.
Description
The SetElementCount 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 constructed using 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.
See Also

Array::GetElementCount

Array::AddElement

Array::InsertElement

Array::RemoveElement