From cb24acca975c41289d25a8db5d16b49adb926e21 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 11 Mar 2013 15:26:05 +0000 Subject: [PATCH] Added a minimum-size template parameter to Array. --- modules/juce_core/containers/juce_Array.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/juce_core/containers/juce_Array.h b/modules/juce_core/containers/juce_Array.h index 2f089d86ab..630ada5eac 100644 --- a/modules/juce_core/containers/juce_Array.h +++ b/modules/juce_core/containers/juce_Array.h @@ -56,7 +56,8 @@ @see OwnedArray, ReferenceCountedArray, StringArray, CriticalSection */ template + typename TypeOfCriticalSectionToUse = DummyCriticalSection, + int minimumAllocatedSize = 0> class Array { private: @@ -1035,8 +1036,8 @@ private: void minimiseStorageAfterRemoval() { - if (data.numAllocated > numUsed * 2) - data.shrinkToNoMoreThan (jmax (numUsed, 64 / (int) sizeof (ElementType))); + if (data.numAllocated > jmax (minimumAllocatedSize, numUsed * 2)) + data.shrinkToNoMoreThan (jmax (numUsed, jmax (minimumAllocatedSize, 64 / (int) sizeof (ElementType)))); } };