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

`#include <juce_ArrayBase.h>`

## Public Member Functions

| ArrayBase (ArrayBase &&other) noexcept
ArrayBase & | operator= (ArrayBase &&other) noexcept
template<class OtherElementType, class OtherCriticalSection, typename = AllowConversion<OtherElementType, OtherCriticalSection>>
| ArrayBase (ArrayBase< OtherElementType, OtherCriticalSection > &&other) noexcept
template<class OtherElementType, class OtherCriticalSection, typename = AllowConversion<OtherElementType, OtherCriticalSection>>
ArrayBase & | operator= (ArrayBase< OtherElementType, OtherCriticalSection > &&other) noexcept
template<class OtherArrayType>
bool | operator== (const OtherArrayType &other) const noexcept
template<class OtherArrayType>
bool | operator!= (const OtherArrayType &other) const noexcept
ElementType & | operator[] (const int index) noexcept
const ElementType & | operator[] (const int index) const noexcept
ElementType | getValueWithDefault (const int index) const noexcept
ElementType | getFirst () const noexcept
ElementType | getLast () const noexcept
ElementType * | begin () noexcept
const ElementType * | begin () const noexcept
ElementType * | end () noexcept
const ElementType * | end () const noexcept
ElementType * | data () noexcept
const ElementType * | data () const noexcept
int | size () const noexcept
int | capacity () const noexcept
void | setAllocatedSize (int numElements)
void | ensureAllocatedSize (int minNumElements)
void | shrinkToNoMoreThan (int maxNumElements)
void | clear ()
void | swapWith (ArrayBase &other) noexcept
void | add (const ElementType &newElement)
void | add (ElementType &&newElement)
template<typename... OtherElements>
void | add (const ElementType &firstNewElement, OtherElements &&... otherElements)
template<typename... OtherElements>
void | add (ElementType &&firstNewElement, OtherElements &&... otherElements)
template<typename Type>
void | addArray (const Type *elementsToAdd, int numElementsToAdd)
template<typename TypeToCreateFrom>
void | addArray (const std::initializer_list< TypeToCreateFrom > &items)
template<class OtherArrayType>
void | addArray (const OtherArrayType &arrayToAddFrom)
template<class OtherArrayType>
std::enable_if_t<! std::is_pointer_v< OtherArrayType >, int > | addArray (const OtherArrayType &arrayToAddFrom, int startIndex, int numElementsToAdd=-1)
void | insert (int indexToInsertAt, ParameterType newElement, int numberOfTimesToInsertIt)
void | insertArray (int indexToInsertAt, const ElementType *newElements, int numberOfElements)
void | removeElements (int indexToRemoveAt, int numElementsToRemove)
void | swap (int index1, int index2)
void | move (int currentIndex, int newIndex) noexcept

## Detailed Description

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

A basic object container.

This class isn't really for public use - it's used by the other array classes, but might come in handy for some purposes.

It inherits from a critical section class to allow the arrays to use the "empty base class optimisation" pattern to reduce their footprint.

See also
  Array, OwnedArray, ReferenceCountedArray

Definition at line 40 of file juce_ArrayBase.h.

## Constructor & Destructor Documentation

## ~ArrayBase()

template<class ElementType, class TypeOfCriticalSectionToUse>

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

inline

Definition at line 53 of file juce_ArrayBase.h.

## ArrayBase() [1/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

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

inline noexcept

Definition at line 58 of file juce_ArrayBase.h.

## ArrayBase() [2/2]

template<class ElementType, class TypeOfCriticalSectionToUse>
template<class OtherElementType, class OtherCriticalSection, typename = AllowConversion<OtherElementType, OtherCriticalSection>>

juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::ArrayBase | ( | ArrayBase< OtherElementType, OtherCriticalSection > && | other | ) |

inline noexcept

Converting move constructor. Only enabled when the other array has a different type to this one. If you see a compile error here, it's probably because you're attempting a conversion that HeapBlock won't allow.

Definition at line 86 of file juce_ArrayBase.h.

## Member Function Documentation

## add() [1/4]

template<class ElementType, class TypeOfCriticalSectionToUse>
template<typename... OtherElements>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::add | ( | const ElementType & | firstNewElement,
|  | OtherElements &&... | otherElements )

inline

Definition at line 267 of file juce_ArrayBase.h.

## add() [2/4]

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::add | ( | const ElementType & | newElement | ) |

inline

Definition at line 256 of file juce_ArrayBase.h.

## add() [3/4]

template<class ElementType, class TypeOfCriticalSectionToUse>
template<typename... OtherElements>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::add | ( | ElementType && | firstNewElement,
|  | OtherElements &&... | otherElements )

inline

Definition at line 273 of file juce_ArrayBase.h.

## add() [4/4]

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::add | ( | ElementType && | newElement | ) |

inline

Definition at line 261 of file juce_ArrayBase.h.

## addArray() [1/4]

template<class ElementType, class TypeOfCriticalSectionToUse>
template<class OtherArrayType>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray | ( | const OtherArrayType & | arrayToAddFrom | ) |

inline

Definition at line 297 of file juce_ArrayBase.h.

## addArray() [2/4]

template<class ElementType, class TypeOfCriticalSectionToUse>
template<class OtherArrayType>

std::enable_if_t<! std::is_pointer_v< OtherArrayType >, int > juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray | ( | const OtherArrayType & | arrayToAddFrom,
|  | int | startIndex,
|  | int | numElementsToAdd = -1 )

inline

Definition at line 308 of file juce_ArrayBase.h.

## addArray() [3/4]

template<class ElementType, class TypeOfCriticalSectionToUse>
template<typename TypeToCreateFrom>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray | ( | const std::initializer_list< TypeToCreateFrom > & | items | ) |

inline

Definition at line 288 of file juce_ArrayBase.h.

## addArray() [4/4]

template<class ElementType, class TypeOfCriticalSectionToUse>
template<typename Type>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray | ( | const Type * | elementsToAdd,
|  | int | numElementsToAdd )

inline

Definition at line 280 of file juce_ArrayBase.h.

## begin() [1/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

const ElementType * juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::begin | ( |  | ) | const

inline noexcept

Definition at line 174 of file juce_ArrayBase.h.

## begin() [2/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

ElementType * juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::begin | ( |  | ) |

inline noexcept

Definition at line 169 of file juce_ArrayBase.h.

## capacity()

template<class ElementType, class TypeOfCriticalSectionToUse>

int juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::capacity | ( |  | ) | const

inline noexcept

Definition at line 204 of file juce_ArrayBase.h.

## clear()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::clear | ( |  | ) |

inline

Definition at line 239 of file juce_ArrayBase.h.

## data() [1/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

const ElementType * juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::data | ( |  | ) | const

inline noexcept

Definition at line 194 of file juce_ArrayBase.h.

## data() [2/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

ElementType * juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::data | ( |  | ) |

inline noexcept

Definition at line 189 of file juce_ArrayBase.h.

## end() [1/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

const ElementType * juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::end | ( |  | ) | const

inline noexcept

Definition at line 184 of file juce_ArrayBase.h.

## end() [2/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

ElementType * juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::end | ( |  | ) |

inline noexcept

Definition at line 179 of file juce_ArrayBase.h.

## ensureAllocatedSize()

template<class ElementType, class TypeOfCriticalSectionToUse>

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

inline

Definition at line 225 of file juce_ArrayBase.h.

## getFirst()

template<class ElementType, class TypeOfCriticalSectionToUse>

ElementType juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getFirst | ( |  | ) | const

inline noexcept

Definition at line 158 of file juce_ArrayBase.h.

## getLast()

template<class ElementType, class TypeOfCriticalSectionToUse>

ElementType juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getLast | ( |  | ) | const

inline noexcept

Definition at line 163 of file juce_ArrayBase.h.

## getValueWithDefault()

template<class ElementType, class TypeOfCriticalSectionToUse>

ElementType juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getValueWithDefault | ( | const int | index | ) | const

inline noexcept

Definition at line 153 of file juce_ArrayBase.h.

## insert()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::insert | ( | int | indexToInsertAt,
|  | ParameterType | newElement,
|  | int | numberOfTimesToInsertIt )

inline

Definition at line 328 of file juce_ArrayBase.h.

## insertArray()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::insertArray | ( | int | indexToInsertAt,
|  | const ElementType * | newElements,
|  | int | numberOfElements )

inline

Definition at line 339 of file juce_ArrayBase.h.

## move()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::move | ( | int | currentIndex,
|  | int | newIndex )

inline noexcept

Definition at line 375 of file juce_ArrayBase.h.

## operator!=()

template<class ElementType, class TypeOfCriticalSectionToUse>
template<class OtherArrayType>

bool juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator!= | ( | const OtherArrayType & | other | ) | const

inline noexcept

Definition at line 133 of file juce_ArrayBase.h.

## operator=() [1/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

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

inline noexcept

Definition at line 67 of file juce_ArrayBase.h.

## operator=() [2/2]

template<class ElementType, class TypeOfCriticalSectionToUse>
template<class OtherElementType, class OtherCriticalSection, typename = AllowConversion<OtherElementType, OtherCriticalSection>>

ArrayBase & juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator= | ( | ArrayBase< OtherElementType, OtherCriticalSection > && | other | ) |

inline noexcept

Converting move assignment operator. Only enabled when the other array has a different type to this one. If you see a compile error here, it's probably because you're attempting a conversion that HeapBlock won't allow.

Definition at line 103 of file juce_ArrayBase.h.

## operator==()

template<class ElementType, class TypeOfCriticalSectionToUse>
template<class OtherArrayType>

bool juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator== | ( | const OtherArrayType & | other | ) | const

inline noexcept

Definition at line 118 of file juce_ArrayBase.h.

## operator[]() [1/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

const ElementType & juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator[] | ( | const int | index | ) | const

inline noexcept

Definition at line 146 of file juce_ArrayBase.h.

## operator[]() [2/2]

template<class ElementType, class TypeOfCriticalSectionToUse>

ElementType & juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator[] | ( | const int | index | ) |

inline noexcept

Definition at line 139 of file juce_ArrayBase.h.

## removeElements()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::removeElements | ( | int | indexToRemoveAt,
|  | int | numElementsToRemove )

inline

Definition at line 350 of file juce_ArrayBase.h.

## setAllocatedSize()

template<class ElementType, class TypeOfCriticalSectionToUse>

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

inline

Definition at line 210 of file juce_ArrayBase.h.

## shrinkToNoMoreThan()

template<class ElementType, class TypeOfCriticalSectionToUse>

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

inline

Definition at line 233 of file juce_ArrayBase.h.

## size()

template<class ElementType, class TypeOfCriticalSectionToUse>

int juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::size | ( |  | ) | const

inline noexcept

Definition at line 199 of file juce_ArrayBase.h.

## swap()

template<class ElementType, class TypeOfCriticalSectionToUse>

void juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::swap | ( | int | index1,
|  | int | index2 )

inline

Definition at line 364 of file juce_ArrayBase.h.

## swapWith()

template<class ElementType, class TypeOfCriticalSectionToUse>

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

inline noexcept

Definition at line 248 of file juce_ArrayBase.h.

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

- juce_ArrayBase.h