Loading...
Searching...
No Matches
juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > Class Template Reference

## Detailed Description

template<class ElementType, class TypeOfCriticalSectionToUse>
class juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >

Implements some basic array storage allocation functions.

This class isn't really for public use - it used to be part of the container classes but has since been superseded by ArrayBase. Eventually it will be removed from the API.

The documentation for this class was generated from the following file:

- juce_core/containers/juce_ArrayAllocationBase.h

Inherits TypeOfCriticalSectionToUse.

## Public Member Functions

| ArrayAllocationBase ()=default
| Creates an empty array.
| ~ArrayAllocationBase ()=default
| Destructor.
| ArrayAllocationBase (ArrayAllocationBase &&other) noexcept
ArrayAllocationBase & | operator= (ArrayAllocationBase &&other) noexcept
void | setAllocatedSize (int numElements)
| Changes the amount of storage allocated.
void | ensureAllocatedSize (int minNumElements)
| Increases the amount of storage allocated if it is less than a given amount.
void | shrinkToNoMoreThan (int maxNumElements)
| Minimises the amount of storage allocated so that it's no more than the given number of elements.
void | swapWith (ArrayAllocationBase &other) noexcept
| Swap the contents of two objects.

## Public Attributes

HeapBlock< ElementType > | elements
int | numAllocated = 0

## Constructors and Destructors

## ArrayAllocationBase() [1/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::ArrayAllocationBase | ( |  | ) |

default

Creates an empty array.

Referenced by ArrayAllocationBase(), operator=(), and swapWith().

## ~ArrayAllocationBase()

template<class ElementType, class TypeOfCriticalSectionToUse>

juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::~ArrayAllocationBase | ( |  | ) |

default

Destructor.

## ArrayAllocationBase() [2/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::ArrayAllocationBase | ( | ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > && | other | ) |

inline noexcept

References ArrayAllocationBase().

## Member Functions

## operator=()

template<class ElementType, class TypeOfCriticalSectionToUse>

ArrayAllocationBase & juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::operator= | ( | ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > && | other | ) |

inline noexcept

References ArrayAllocationBase(), elements, and numAllocated.

## setAllocatedSize()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize | ( | int | numElements | ) |

inline

Changes the amount of storage allocated.

This will retain any data currently held in the array, and either add or remove extra space at the end.

Parameters

  numElements | the number of elements that are needed

References elements, and numAllocated.

Referenced by ensureAllocatedSize(), and shrinkToNoMoreThan().

## ensureAllocatedSize()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize | ( | int | minNumElements | ) |

inline

Increases the amount of storage allocated if it is less than a given amount.

This will retain any data currently held in the array, but will add extra space at the end to make sure there it's at least as big as the size passed in. If it's already bigger, no action is taken.

Parameters

  minNumElements | the minimum number of elements that are needed

References elements, jassert, numAllocated, and setAllocatedSize().

## shrinkToNoMoreThan()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::shrinkToNoMoreThan | ( | int | maxNumElements | ) |

inline

Minimises the amount of storage allocated so that it's no more than the given number of elements.

References numAllocated, and setAllocatedSize().

## swapWith()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::swapWith | ( | ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > & | other | ) |

inline noexcept

Swap the contents of two objects.

References ArrayAllocationBase(), elements, and numAllocated.

## Member Data Documentation

## elements

template<class ElementType, class TypeOfCriticalSectionToUse>

HeapBlock<ElementType> juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::elements

Referenced by ensureAllocatedSize(), operator=(), setAllocatedSize(), and swapWith().

## numAllocated

template<class ElementType, class TypeOfCriticalSectionToUse>

int juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::numAllocated = 0

Referenced by ensureAllocatedSize(), operator=(), setAllocatedSize(), shrinkToNoMoreThan(), and swapWith().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited