A basic object container. More...
#include <juce_ArrayBase.h>
Inherits TypeOfCriticalSectionToUse.

Public Member Functions | |
| ArrayBase () noexcept=default | |
| ArrayBase (ArrayBase &&other) noexcept | |
| template<class OtherElementType , class OtherCriticalSection , typename = AllowConversion<OtherElementType, OtherCriticalSection>> | |
| ArrayBase (ArrayBase< OtherElementType, OtherCriticalSection > &&other) noexcept | |
| Converting move constructor. | |
| ~ArrayBase () | |
| template<typename... OtherElements> | |
| void | add (const ElementType &firstNewElement, OtherElements &&... otherElements) |
| void | add (const ElementType &newElement) |
| template<typename... OtherElements> | |
| void | add (ElementType &&firstNewElement, OtherElements &&... otherElements) |
| void | add (ElementType &&newElement) |
| 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) |
| template<typename TypeToCreateFrom > | |
| void | addArray (const std::initializer_list< TypeToCreateFrom > &items) |
| template<typename Type > | |
| void | addArray (const Type *elementsToAdd, int numElementsToAdd) |
| const ElementType * | begin () const noexcept |
| ElementType * | begin () noexcept |
| int | capacity () const noexcept |
| void | clear () |
| const ElementType * | data () const noexcept |
| ElementType * | data () noexcept |
| const ElementType * | end () const noexcept |
| ElementType * | end () noexcept |
| void | ensureAllocatedSize (int minNumElements) |
| ElementType | getFirst () const noexcept |
| ElementType | getLast () const noexcept |
| ElementType | getValueWithDefault (const int index) const noexcept |
| void | insert (int indexToInsertAt, ParameterType newElement, int numberOfTimesToInsertIt) |
| void | insertArray (int indexToInsertAt, const ElementType *newElements, int numberOfElements) |
| void | move (int currentIndex, int newIndex) noexcept |
| template<class OtherArrayType > | |
| bool | operator!= (const OtherArrayType &other) const noexcept |
| ArrayBase & | operator= (ArrayBase &&other) noexcept |
| template<class OtherElementType , class OtherCriticalSection , typename = AllowConversion<OtherElementType, OtherCriticalSection>> | |
| ArrayBase & | operator= (ArrayBase< OtherElementType, OtherCriticalSection > &&other) noexcept |
| Converting move assignment operator. | |
| template<class OtherArrayType > | |
| bool | operator== (const OtherArrayType &other) const noexcept |
| const ElementType & | operator[] (const int index) const noexcept |
| ElementType & | operator[] (const int index) noexcept |
| void | removeElements (int indexToRemoveAt, int numElementsToRemove) |
| void | setAllocatedSize (int numElements) |
| void | shrinkToNoMoreThan (int maxNumElements) |
| int | size () const noexcept |
| void | swap (int index1, int index2) |
| void | swapWith (ArrayBase &other) noexcept |
Private Types | |
| template<class OtherElementType , class OtherCriticalSection > | |
| using | AllowConversion = std::enable_if_t<! std::is_same_v< std::tuple< ElementType, TypeOfCriticalSectionToUse >, std::tuple< OtherElementType, OtherCriticalSection > > > |
| using | ParameterType = typename TypeHelpers::ParameterType< ElementType >::type |
Private Member Functions | |
| template<typename Type > | |
| void | addArrayInternal (const Type *otherElements, int numElements) |
| template<typename... Elements> | |
| void | addAssumingCapacityIsReady (Elements &&... toAdd) |
| template<typename... Elements> | |
| void | addImpl (Elements &&... toAdd) |
| void | checkSourceIsNotAMember (const ElementType &element) |
| ElementType * | createInsertSpace (int indexToInsertAt, int numElements) |
| void | createInsertSpaceInternal (int indexToInsertAt, int numElements) |
| void | moveAssignElement (ElementType *destination, ElementType &&source) |
| void | moveInternal (int currentIndex, int newIndex) noexcept |
| void | removeElementsInternal (int indexToRemoveAt, int numElementsToRemove) |
| void | setAllocatedSizeInternal (int numElements) |
Private Attributes | |
| HeapBlock< ElementType > | elements |
| int | numAllocated = 0 |
| int | numUsed = 0 |
Static Private Attributes | |
| static constexpr auto | isTriviallyCopyable = std::is_trivially_copyable_v<ElementType> |
Friends | |
| template<class OtherElementType , class OtherCriticalSection > | |
| class | ArrayBase |
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.
@tags{Core}
|
private |
|
private |
|
defaultnoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
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.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArrayInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray().
|
inlineprivate |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::isTriviallyCopyable, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray().
|
inlineprivate |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addImpl().
|
inlineprivate |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addAssumingCapacityIsReady(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::checkSourceIsNotAMember(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::add(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::add(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::add(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::add().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineprivate |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::begin(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::end(), and jassert.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addImpl(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::insert().
|
inline |
|
inlineprivate |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpaceInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize(), juce::isPositiveAndBelow(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::insert(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::insertArray().
|
inlineprivate |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::end(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::isTriviallyCopyable, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpace().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::checkSourceIsNotAMember(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpaceInternal().
|
inline |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, jassert, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numAllocated, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize().
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addImpl(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpace().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlineprivate |
|
inlineprivatenoexcept |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::isTriviallyCopyable, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::moveAssignElement().
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::move().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
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.
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numAllocated, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlineprivate |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::isTriviallyCopyable, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::moveAssignElement(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::removeElements().
|
inline |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, jassert, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numAllocated, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSizeInternal().
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::shrinkToNoMoreThan().
|
inlineprivate |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::isTriviallyCopyable, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize().
|
inline |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
References juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::elements, juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numAllocated, and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::numUsed.
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator=().
|
friend |
|
private |
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArrayInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addAssumingCapacityIsReady(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::begin(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::begin(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::clear(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpace(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpaceInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::data(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::data(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::end(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::end(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getFirst(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getLast(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getValueWithDefault(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::moveInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator=(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator[](), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator[](), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::removeElementsInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSizeInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::swap(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::swapWith().
|
staticconstexprprivate |
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArrayInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpaceInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::moveInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::removeElementsInternal(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSizeInternal().
|
private |
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::capacity(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator=(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::shrinkToNoMoreThan(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::swapWith().
|
private |
Referenced by juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArray(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addArrayInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addAssumingCapacityIsReady(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::addImpl(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::clear(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpace(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::createInsertSpaceInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::end(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::end(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getFirst(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getLast(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getValueWithDefault(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::insert(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::insertArray(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::move(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator=(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator[](), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator[](), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::removeElements(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::removeElementsInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSizeInternal(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::size(), juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::swap(), and juce::ArrayBase< ElementType, TypeOfCriticalSectionToUse >::swapWith().