juce::Array<..., ..., int minimumAllocatedSize> and not size_t?


#1

I’m surprised no one has asked this yet, but based on the definition of juce::Array, this is possible:

juce::Array<Listener*, DummyCriticalSection, -1> myWeirdArray;

I realize that the only usage of that 3rd parameter is in

    void minimiseStorageAfterRemoval()
    {
        if (values.capacity() > jmax (minimumAllocatedSize, values.size() * 2))
            values.shrinkToNoMoreThan (jmax (values.size(), jmax (minimumAllocatedSize, 64 / (int) sizeof (ElementType))));
    }

but, still… is there a reason for that?

Is it just to avoid all of the warnings about size_t being compared with an int?


#2

TBH that template parameter is probably redundant and could be removed. I think it might just be a very old legacy thing.