40 template <
class ElementType,
class TypeOfCriticalSectionToUse>
52 : elements (std::move (other.elements)),
53 numAllocated (other.numAllocated)
59 elements = std::move (other.elements);
60 numAllocated = other.numAllocated;
74 if (numAllocated != numElements)
77 elements.
realloc ((
size_t) numElements);
81 numAllocated = numElements;
95 if (minNumElements > numAllocated)
98 jassert (numAllocated <= 0 || elements !=
nullptr);
106 if (maxNumElements < numAllocated)
114 std::swap (numAllocated, other.numAllocated);
119 int numAllocated = 0;
void shrinkToNoMoreThan(int maxNumElements)
Minimises the amount of storage allocated so that it's no more than the given number of elements...
void realloc(SizeType newNumElements, size_t elementSize=sizeof(ElementType))
Re-allocates a specified amount of memory.
void ensureAllocatedSize(int minNumElements)
Increases the amount of storage allocated if it is less than a given amount.
~ArrayAllocationBase()=default
Destructor.
ArrayAllocationBase()=default
Creates an empty array.
void setAllocatedSize(int numElements)
Changes the amount of storage allocated.
void free() noexcept
Frees any currently-allocated data.
void swapWith(HeapBlock< ElementType, otherBlockThrows > &other) noexcept
Swaps this object's data with the data of another HeapBlock.
void swapWith(ArrayAllocationBase &other) noexcept
Swap the contents of two objects.
Implements some basic array storage allocation functions.