36template <
class ElementType,
class TypeOfCriticalSectionToUse>
48 : elements (std::move (
other.elements)),
49 numAllocated (
other.numAllocated)
55 elements = std::move (
other.elements);
56 numAllocated =
other.numAllocated;
94 jassert (numAllocated <= 0 || elements !=
nullptr);
109 elements.swapWith (
other.elements);
115 int numAllocated = 0;
Implements some basic array storage allocation functions.
void shrinkToNoMoreThan(int maxNumElements)
Minimises the amount of storage allocated so that it's no more than the given number of elements.
ArrayAllocationBase()=default
Creates an empty array.
~ArrayAllocationBase()=default
Destructor.
void ensureAllocatedSize(int minNumElements)
Increases the amount of storage allocated if it is less than a given amount.
void setAllocatedSize(int numElements)
Changes the amount of storage allocated.
void swapWith(ArrayAllocationBase &other) noexcept
Swap the contents of two objects.
Very simple container class to hold a pointer to some data on the heap.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...