Commit aac4394c authored by hybrid's avatar hybrid

Add new parameter to array reallocate function. This prevents a reallocation...

Add new parameter to array reallocate function. This prevents a reallocation in case the array would become smaller. As the reallocation operation is quite time consuming, this can be avoided on request now, on the expense of more memory consumption.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4261 dfc29bdd-3216-0410-991c-e03cc46cb475
parent dde2b587
......@@ -59,11 +59,17 @@ public:
//! Reallocates the array, make it bigger or smaller.
/** \param new_size New size of array. */
void reallocate(u32 new_size)
/** \param new_size New size of array.
\param canShrink Specifies whether the array is reallocated even if
enough space is available. Setting this flag to false can speed up
array usage, but may use more memory than required by the data.
*/
void reallocate(u32 new_size, bool canShrink=true)
{
if (allocated==new_size)
return;
if (!canShrink && (new_size < allocated))
return;
T* old_data = data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment