OpenShot Audio Library | OpenShotAudio 0.3.2
Loading...
Searching...
No Matches
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize > Class Template Reference

#include <juce_Array.h>

Public Types

using ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType
 

Public Member Functions

 Array ()=default
 
 Array (const Array &other)
 
 Array (Array &&other) noexcept
 
template<typename TypeToCreateFrom >
 Array (const TypeToCreateFrom *data)
 
template<typename TypeToCreateFrom >
 Array (const TypeToCreateFrom *data, int numValues)
 
 Array (const ElementType &singleElementToAdd)
 
 Array (ElementType &&singleElementToAdd)
 
template<typename... OtherElements>
 Array (const ElementType &firstNewElement, OtherElements... otherElements)
 
template<typename... OtherElements>
 Array (ElementType &&firstNewElement, OtherElements... otherElements)
 
template<typename TypeToCreateFrom >
 Array (const std::initializer_list< TypeToCreateFrom > &items)
 
 ~Array ()=default
 
Arrayoperator= (const Array &other)
 
Arrayoperator= (Array &&other) noexcept
 
template<class OtherArrayType >
bool operator== (const OtherArrayType &other) const
 
template<class OtherArrayType >
bool operator!= (const OtherArrayType &other) const
 
void clear ()
 
void clearQuick ()
 
void fill (const ParameterType &newValue) noexcept
 
int size () const noexcept
 
bool isEmpty () const noexcept
 
ElementType operator[] (int index) const
 
ElementType getUnchecked (int index) const
 
ElementType & getReference (int index) noexcept
 
const ElementType & getReference (int index) const noexcept
 
ElementType getFirst () const noexcept
 
ElementType getLast () const noexcept
 
ElementType * getRawDataPointer () noexcept
 
const ElementType * getRawDataPointer () 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 indexOf (ParameterType elementToLookFor) const
 
bool contains (ParameterType elementToLookFor) const
 
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)
 
void insert (int indexToInsertAt, ParameterType newElement)
 
void insertMultiple (int indexToInsertAt, ParameterType newElement, int numberOfTimesToInsertIt)
 
void insertArray (int indexToInsertAt, const ElementType *newElements, int numberOfElements)
 
bool addIfNotAlreadyThere (ParameterType newElement)
 
void set (int indexToChange, ParameterType newValue)
 
void setUnchecked (int indexToChange, ParameterType newValue)
 
template<typename Type >
void addArray (const Type *elementsToAdd, int numElementsToAdd)
 
template<typename TypeToCreateFrom >
void addArray (const std::initializer_list< TypeToCreateFrom > &items)
 
template<typename Type >
void addNullTerminatedArray (const Type *const *elementsToAdd)
 
template<class OtherArrayType >
void swapWith (OtherArrayType &otherArray) noexcept
 
template<class OtherArrayType >
void addArray (const OtherArrayType &arrayToAddFrom)
 
template<class OtherArrayType >
std::enable_if<!std::is_pointer< OtherArrayType >::value, void >::type addArray (const OtherArrayType &arrayToAddFrom, int startIndex, int numElementsToAdd=-1)
 
void resize (int targetNumItems)
 
template<class ElementComparator >
int addSorted (ElementComparator &comparator, ParameterType newElement)
 
void addUsingDefaultSort (ParameterType newElement)
 
template<typename ElementComparator , typename TargetValueType >
int indexOfSorted (ElementComparator &comparator, TargetValueType elementToLookFor) const
 
void remove (int indexToRemove)
 
ElementType removeAndReturn (int indexToRemove)
 
void remove (const ElementType *elementToRemove)
 
void removeFirstMatchingValue (ParameterType valueToRemove)
 
int removeAllInstancesOf (ParameterType valueToRemove)
 
template<typename PredicateType >
int removeIf (PredicateType &&predicate)
 
void removeRange (int startIndex, int numberToRemove)
 
void removeLast (int howManyToRemove=1)
 
template<class OtherArrayType >
void removeValuesIn (const OtherArrayType &otherArray)
 
template<class OtherArrayType >
void removeValuesNotIn (const OtherArrayType &otherArray)
 
void swap (int index1, int index2)
 
void move (int currentIndex, int newIndex) noexcept
 
void minimiseStorageOverheads ()
 
void ensureStorageAllocated (int minNumElements)
 
void sort ()
 
template<class ElementComparator >
void sort (ElementComparator &comparator, bool retainOrderOfEquivalentItems=false)
 
const TypeOfCriticalSectionToUse & getLock () const noexcept
 
void minimiseStorageAfterRemoval ()
 

Public Attributes

JUCE_DEPRECATED_WITH_BODY(void swapWithArray(Array &other) noexcept, { swapWith(other);}) private void removeInternal (int indexToRemove)
 

Detailed Description

template<typename ElementType, typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
class juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >

Holds a resizable array of primitive or copy-by-value objects.

Examples of arrays are: Array<int>, Array<Rectangle> or Array<MyClass*>

The Array class can be used to hold simple, non-polymorphic objects as well as primitive types - to do so, the class must fulfill these requirements:

  • it must have a copy constructor and assignment operator
  • it must be able to be relocated in memory by a memcpy without this causing any problems - so objects whose functionality relies on external pointers or references to themselves can not be used.

You can of course have an array of pointers to any kind of object, e.g. Array<MyClass*>, but if you do this, the array doesn't take any ownership of the objects - see the OwnedArray class or the ReferenceCountedArray class for more powerful ways of holding lists of objects.

For holding lists of strings, you can use Array<String>, but it's usually better to use the specialised class StringArray, which provides more useful functions.

To make all the array's methods thread-safe, pass in "CriticalSection" as the templated TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection.

See also
OwnedArray, ReferenceCountedArray, StringArray, CriticalSection

Definition at line 55 of file juce_Array.h.

Member Typedef Documentation

◆ ScopedLockType

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
using juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType

Returns the type of scoped lock to use for locking this array

Definition at line 1123 of file juce_Array.h.

Constructor & Destructor Documentation

◆ Array() [1/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( )
default

Creates an empty array.

Referenced by juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addNullTerminatedArray(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::contains(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOfSorted(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator=(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator==(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeAllInstancesOf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeAndReturn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeIf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesIn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesNotIn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::set(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::setUnchecked(), and juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::swapWith().

◆ Array() [2/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( const Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize > &  other)
inline

Creates a copy of another array.

Parameters
otherthe array to copy

Definition at line 68 of file juce_Array.h.

◆ Array() [3/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize > &&  other)
inlinenoexcept

Definition at line 74 of file juce_Array.h.

◆ Array() [4/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( const TypeToCreateFrom data)
inlineexplicit

Initalises from a null-terminated raw array of values.

Parameters
datathe data to copy from

Definition at line 83 of file juce_Array.h.

◆ Array() [5/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( const TypeToCreateFrom data,
int  numValues 
)
inline

Initalises from a raw array of values.

Parameters
datathe data to copy from
numValuesthe number of values in the array

Definition at line 94 of file juce_Array.h.

◆ Array() [6/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( const ElementType &  singleElementToAdd)
inline

Initalises an Array of size 1 containing a single element.

Definition at line 100 of file juce_Array.h.

◆ Array() [7/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( ElementType &&  singleElementToAdd)
inline

Initalises an Array of size 1 containing a single element.

Definition at line 106 of file juce_Array.h.

◆ Array() [8/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<typename... OtherElements>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( const ElementType &  firstNewElement,
OtherElements...  otherElements 
)
inline

Initalises an Array from a list of items.

Definition at line 113 of file juce_Array.h.

◆ Array() [9/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<typename... OtherElements>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( ElementType &&  firstNewElement,
OtherElements...  otherElements 
)
inline

Initalises an Array from a list of items.

Definition at line 120 of file juce_Array.h.

◆ Array() [10/10]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array ( const std::initializer_list< TypeToCreateFrom > &  items)
inline

Definition at line 126 of file juce_Array.h.

◆ ~Array()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::~Array ( )
default

Destructor.

Member Function Documentation

◆ add() [1/4]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<typename... OtherElements>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add ( const ElementType &  firstNewElement,
OtherElements...  otherElements 
)
inline

Appends multiple new elements at the end of the array.

Definition at line 436 of file juce_Array.h.

◆ add() [2/4]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add ( const ElementType &  newElement)
inline

Appends a new element at the end of the array.

Parameters
newElementthe new object to add to the array
See also
set, insert, addIfNotAlreadyThere, addSorted, addUsingDefaultSort, addArray

Definition at line 418 of file juce_Array.h.

Referenced by juce::StringArray::add(), juce::ActionBroadcaster::addActionListener(), juce::StringArray::addArray(), juce::AudioDeviceManager::addAudioCallback(), juce::AudioDeviceManager::addAudioDeviceType(), juce::ChangeBroadcaster::addChangeListener(), juce::dsp::Oversampling< SampleType >::addDummyOversamplingStage(), juce::ZipFile::Builder::addFile(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addIfNotAlreadyThere(), juce::MixerAudioSource::addInputSource(), juce::ThreadPool::addJob(), juce::StringArray::addLines(), juce::Thread::addListener(), juce::MPEZoneLayout::addListener(), juce::Value::addListener(), juce::ValueTree::addListener(), juce::MPEInstrument::addListener(), juce::ThreadPoolJob::addListener(), juce::AudioDeviceManager::addMidiInputDeviceCallback(), juce::dsp::Oversampling< SampleType >::addOversamplingStage(), juce::SparseSet< Type >::addRange(), juce::MidiMessageSequence::addSequence(), juce::MidiMessageSequence::addSequence(), juce::Synthesiser::addSound(), juce::StringArray::addTokens(), juce::MidiFile::addTrack(), juce::MPESynthesiser::addVoice(), juce::Synthesiser::addVoice(), juce::var::append(), juce::ArgumentList::ArgumentList(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::AudioChannelSet::channelSetsWithNumberOfChannels(), juce::dsp::IIR::Coefficients< NumericType >::Coefficients(), juce::dsp::Convolution::copyAndLoadImpulseResponseFromBlock(), juce::MidiMessageSequence::createControllerUpdatesForTime(), juce::DeletedAtShutdown::DeletedAtShutdown(), juce::dsp::FilterDesign< FloatType >::designFIRLowpassHalfBandEquirippleMethod(), juce::dsp::FilterDesign< FloatType >::designIIRHighpassHighOrderButterworthMethod(), juce::dsp::FilterDesign< FloatType >::designIIRLowpassHalfBandPolyphaseAllpassMethod(), juce::dsp::FilterDesign< FloatType >::designIIRLowpassHighOrderButterworthMethod(), juce::BigInteger::extendedEuclidean(), juce::File::findChildFiles(), juce::MPEChannelAssigner::findMidiChannelForNewNote(), juce::MPESynthesiser::findVoiceToSteal(), juce::Synthesiser::findVoiceToSteal(), juce::UndoManager::getActionsInCurrentTransaction(), juce::AudioChannelSet::getChannelTypes(), juce::RelativeTime::getDescription(), juce::SystemStats::getDeviceIdentifiers(), juce::IIRFilterAudioSource::getNextAudioBlock(), juce::dsp::Polynomial< FloatingType >::getProductWith(), juce::UndoManager::getRedoDescriptions(), juce::AudioChannelSet::getSpeakerArrangementAsString(), juce::UnitTest::getTestsInCategory(), juce::UndoManager::getUndoDescriptions(), juce::IIRFilterAudioSource::IIRFilterAudioSource(), juce::dsp::ConvolutionEngine::initializeConvolutionEngine(), juce::IPAddress::IPAddress(), juce::ChildProcessMaster::launchSlaveProcess(), juce::dsp::Convolution::loadImpulseResponse(), juce::dsp::Convolution::loadImpulseResponse(), juce::MPEInstrument::noteOn(), juce::dsp::SIMDRegister< Type >::operator+(), juce::dsp::SIMDRegister< Type >::operator+(), juce::dsp::SIMDRegister< Type >::operator+=(), juce::dsp::SIMDRegister< Type >::operator+=(), juce::ValueTree::operator=(), juce::UndoManager::perform(), juce::dsp::Polynomial< FloatingType >::Polynomial(), juce::var::readFromStream(), juce::Value::referTo(), juce::AudioFormatManager::registerFormat(), juce::MixerAudioSource::removeAllInputs(), juce::ThreadPool::removeAllJobs(), juce::ChannelRemappingAudioSource::restoreFromXml(), juce::NamedValueSet::set(), juce::NamedValueSet::set(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::set(), juce::NamedValueSet::setFromXmlAttributes(), juce::ChannelRemappingAudioSource::setInputChannelMapping(), juce::ChannelRemappingAudioSource::setOutputChannelMapping(), juce::StringArray::StringArray(), juce::ReadWriteLock::tryEnterRead(), and juce::UnitTest::UnitTest().

◆ add() [3/4]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<typename... OtherElements>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add ( ElementType &&  firstNewElement,
OtherElements...  otherElements 
)
inline

Appends multiple new elements at the end of the array.

Definition at line 444 of file juce_Array.h.

◆ add() [4/4]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add ( ElementType &&  newElement)
inline

Appends a new element at the end of the array.

Parameters
newElementthe new object to add to the array
See also
set, insert, addIfNotAlreadyThere, addSorted, addUsingDefaultSort, addArray

Definition at line 428 of file juce_Array.h.

◆ addArray() [1/4]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<class OtherArrayType >
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray ( const OtherArrayType arrayToAddFrom)
inline

Adds elements from another array to the end of this array.

Parameters
arrayToAddFromthe array from which to copy the elements
See also
add

Definition at line 634 of file juce_Array.h.

◆ addArray() [2/4]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<class OtherArrayType >
std::enable_if<!std::is_pointer< OtherArrayType >::value, void >::type juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray ( const OtherArrayType arrayToAddFrom,
int  startIndex,
int  numElementsToAdd = -1 
)
inline

Adds elements from another array to the end of this array.

Parameters
arrayToAddFromthe array from which to copy the elements
startIndexthe first element of the other array to start copying from
numElementsToAddhow many elements to add from the other array. If this value is negative or greater than the number of available elements, all available elements will be copied.
See also
add

Definition at line 653 of file juce_Array.h.

◆ addArray() [3/4]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray ( const std::initializer_list< TypeToCreateFrom > &  items)
inline

Definition at line 592 of file juce_Array.h.

◆ addArray() [4/4]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<typename Type >
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray ( const Type *  elementsToAdd,
int  numElementsToAdd 
)
inline

◆ addIfNotAlreadyThere()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
bool juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addIfNotAlreadyThere ( ParameterType  newElement)
inline

Appends a new element at the end of the array as long as the array doesn't already contain it.

If the array already contains an element that matches the one passed in, nothing will be done.

Parameters
newElementthe new object to add to the array
Returns
true if the element was added to the array; false otherwise.

Definition at line 522 of file juce_Array.h.

Referenced by juce::ListenerList< ListenerClass, ArrayType >::add(), juce::MidiKeyboardState::addListener(), juce::TimeSliceThread::addTimeSliceClient(), and juce::UnitTest::getAllCategories().

◆ addNullTerminatedArray()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<typename Type >
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addNullTerminatedArray ( const Type *const elementsToAdd)
inline

Adds elements from a null-terminated array of pointers to the end of this array.

Parameters
elementsToAddan array of pointers to some kind of object from which elements can be constructed. This array must be terminated by a nullptr
See also
addArray

Definition at line 605 of file juce_Array.h.

Referenced by juce::StringArray::StringArray(), and juce::StringArray::StringArray().

◆ addSorted()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
int juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addSorted ( ElementComparator comparator,
ParameterType  newElement 
)
inline

Inserts a new element into the array, assuming that the array is sorted.

This will use a comparator to find the position at which the new element should go. If the array isn't sorted, the behaviour of this method will be unpredictable.

Parameters
comparatorthe comparator to use to compare the elements - see the sort() method for details about the form this object should take
newElementthe new element to insert to the array
Returns
the index at which the new item was added
See also
addUsingDefaultSort, add, sort

Definition at line 694 of file juce_Array.h.

Referenced by juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addUsingDefaultSort().

◆ addUsingDefaultSort()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addUsingDefaultSort ( ParameterType  newElement)
inline

Inserts a new element into the array, assuming that the array is sorted.

This will use the DefaultElementComparator class for sorting, so your ElementType must be suitable for use with that class. If the array isn't sorted, the behaviour of this method will be unpredictable.

Parameters
newElementthe new element to insert to the array
See also
addSorted, sort

Definition at line 711 of file juce_Array.h.

◆ begin() [1/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
const ElementType * juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::begin ( ) const
inlinenoexcept

Returns a pointer to the first element in the array. This method is provided for compatibility with standard C++ iteration mechanisms.

Definition at line 336 of file juce_Array.h.

◆ begin() [2/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType * juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::begin ( )
inlinenoexcept

Returns a pointer to the first element in the array. This method is provided for compatibility with standard C++ iteration mechanisms.

Definition at line 328 of file juce_Array.h.

Referenced by juce::MidiBuffer::addEvent(), juce::SparseSet< Type >::addRange(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addSorted(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::MidiMessageSequence::begin(), juce::AudioFormatManager::begin(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::begin(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::begin(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::begin(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::begin(), juce::StringArray::begin(), juce::MidiMessageSequence::begin(), juce::AudioFormatManager::begin(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::begin(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::begin(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::begin(), juce::StringArray::begin(), juce::dsp::Matrix< ElementType >::clear(), juce::MidiBuffer::clear(), juce::dsp::Matrix< ElementType >::compare(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::contains(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::contains(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::contains(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::data(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::data(), juce::MPESynthesiser::findVoiceToSteal(), juce::Synthesiser::findVoiceToSteal(), juce::MidiBuffer::getFirstEventTime(), juce::MidiBuffer::getLastEventTime(), juce::dsp::IIR::Coefficients< NumericType >::getMagnitudeForFrequency(), juce::dsp::IIR::Coefficients< NumericType >::getMagnitudeForFrequencyArray(), juce::MidiBuffer::getNumEvents(), juce::dsp::IIR::Coefficients< NumericType >::getPhaseForFrequency(), juce::dsp::IIR::Coefficients< NumericType >::getPhaseForFrequencyArray(), juce::dsp::FIR::Coefficients< NumericType >::getRawCoefficients(), juce::dsp::IIR::Coefficients< NumericType >::getRawCoefficients(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getRawDataPointer(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::getRawDataPointer(), juce::dsp::Matrix< ElementType >::getRawDataPointer(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getRawDataPointer(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::getRawDataPointer(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::indexOf(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::indexOf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOf(), juce::StringArray::operator=(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::ReferenceCountedArray(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::ReferenceCountedArray(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::remove(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeFirstMatchingValue(), juce::MidiBuffer::Iterator::setNextSamplePosition(), juce::StringArray::sort(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::sort(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::sort(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::sort(), juce::StringArray::sortNatural(), juce::StringArray::StringArray(), and juce::dsp::Matrix< ElementType >::toString().

◆ clear()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::clear ( )
inline

Removes all elements from the array. This will remove all the elements, and free any storage that the array is using. To clear the array without freeing the storage, use the clearQuick() method instead.

See also
clearQuick

Definition at line 188 of file juce_Array.h.

Referenced by juce::MPEChannelAssigner::allNotesOff(), juce::MidiFile::clear(), juce::ListenerList< ListenerClass, ArrayType >::clear(), juce::NamedValueSet::clear(), juce::SparseSet< Type >::clear(), juce::StringArray::clear(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::clear(), juce::AudioSourceChannelInfo::clearActiveBufferRegion(), juce::ChannelRemappingAudioSource::clearAllMappings(), juce::AudioFormatManager::clearFormats(), juce::dsp::Oversampling< SampleType >::clearOversamplingStages(), juce::Synthesiser::clearSounds(), juce::MPESynthesiser::clearVoices(), juce::Synthesiser::clearVoices(), juce::DeletedAtShutdown::deleteAll(), juce::BigInteger::divideBy(), juce::BigInteger::extendedEuclidean(), juce::BufferingAudioSource::getNextAudioBlock(), juce::AudioTransportSource::getNextAudioBlock(), juce::MemoryAudioSource::getNextAudioBlock(), juce::dsp::ConvolutionEngine::initializeConvolutionEngine(), juce::dsp::Oscillator< SampleType >::process(), juce::MPEInstrument::releaseAllNotes(), juce::ActionBroadcaster::removeAllActionListeners(), juce::ChangeBroadcaster::removeAllChangeListeners(), juce::MixerAudioSource::removeAllInputs(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesIn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesNotIn(), juce::UnitTestRunner::runTests(), and juce::MultiTimer::~MultiTimer().

◆ clearQuick()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::clearQuick ( )
inline

◆ contains()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
bool juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::contains ( ParameterType  elementToLookFor) const
inline

◆ data() [1/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
const ElementType * juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::data ( ) const
inlinenoexcept

Returns a pointer to the first element in the array. This method is provided for compatibility with the standard C++ containers.

Definition at line 368 of file juce_Array.h.

◆ data() [2/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType * juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::data ( )
inlinenoexcept

Returns a pointer to the first element in the array. This method is provided for compatibility with the standard C++ containers.

Definition at line 360 of file juce_Array.h.

Referenced by juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::addSet(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::CharPointer_ASCII::compare(), juce::CharPointer_ASCII::compareUpTo(), juce::AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::convertSamples(), juce::MidiBuffer::Iterator::getNextEvent(), juce::MidiBuffer::Iterator::getNextEvent(), juce::AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::getRawData(), juce::HeapBlock< ElementType, throwOnFailure >::HeapBlock(), juce::HeapBlock< ElementType, throwOnFailure >::HeapBlock(), juce::MemoryBlock::MemoryBlock(), juce::MemoryBlock::operator=(), juce::MidiBuffer::operator=(), juce::HeapBlock< ElementType, throwOnFailure >::operator=(), juce::HeapBlock< ElementType, throwOnFailure >::operator=(), juce::MemoryBlock::operator=(), juce::CharPointer_ASCII::operator==(), juce::CharPointer_UTF16::operator==(), juce::CharPointer_UTF32::operator==(), juce::CharPointer_UTF8::operator==(), juce::MemoryBlock::operator==(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::operator==(), juce::SamplerVoice::renderNextBlock(), juce::MidiBuffer::Iterator::setNextSamplePosition(), juce::HeapBlock< ElementType, throwOnFailure >::swapWith(), juce::MemoryBlock::swapWith(), juce::MidiBuffer::swapWith(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::swapWith(), juce::CharPointer_UTF16::writeAll(), juce::CharPointer_UTF32::writeAll(), and juce::CharPointer_UTF8::writeAll().

◆ end() [1/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
const ElementType * juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::end ( ) const
inlinenoexcept

Returns a pointer to the element which follows the last element in the array. This method is provided for compatibility with standard C++ iteration mechanisms.

Definition at line 352 of file juce_Array.h.

◆ end() [2/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType * juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::end ( )
inlinenoexcept

Returns a pointer to the element which follows the last element in the array. This method is provided for compatibility with standard C++ iteration mechanisms.

Definition at line 344 of file juce_Array.h.

Referenced by juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::addArray(), juce::MidiBuffer::addEvent(), juce::SparseSet< Type >::addRange(), juce::MidiBuffer::clear(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::contains(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::contains(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::contains(), juce::Range< ValueType >::contains(), juce::MidiMessageSequence::end(), juce::AudioFormatManager::end(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::end(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::end(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::end(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::end(), juce::StringArray::end(), juce::MidiMessageSequence::end(), juce::AudioFormatManager::end(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::end(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::end(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::end(), juce::StringArray::end(), juce::MPESynthesiser::findVoiceToSteal(), juce::Synthesiser::findVoiceToSteal(), juce::Range< ValueType >::getIntersectionWith(), juce::MidiBuffer::getLastEventTime(), juce::MidiBuffer::Iterator::getNextEvent(), juce::MidiBuffer::Iterator::getNextEvent(), juce::MidiBuffer::getNumEvents(), juce::Range< ValueType >::getUnionWith(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::indexOf(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::indexOf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOf(), juce::Range< ValueType >::intersects(), juce::StringArray::operator=(), juce::StringArray::sort(), juce::StringArray::sortNatural(), and juce::StringArray::StringArray().

◆ ensureStorageAllocated()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::ensureStorageAllocated ( int  minNumElements)
inline

Increases the array's internal storage to hold a minimum number of elements.

Calling this before adding a large known number of elements means that the array won't have to keep dynamically resizing itself as the elements are added, and it'll therefore be more efficient.

Definition at line 1062 of file juce_Array.h.

Referenced by juce::MidiBuffer::ensureSize(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::ensureStorageAllocated(), juce::StringArray::ensureStorageAllocated(), juce::MPESynthesiser::findVoiceToSteal(), juce::Synthesiser::findVoiceToSteal(), and juce::ReadWriteLock::ReadWriteLock().

◆ fill()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::fill ( const ParameterType &  newValue)
inlinenoexcept

Fills the Array with the provided value.

Definition at line 205 of file juce_Array.h.

Referenced by juce::dsp::LadderFilter< Type >::reset().

◆ getFirst()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getFirst ( ) const
inlinenoexcept

◆ getLast()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getLast ( ) const
inlinenoexcept

◆ getLock()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
const TypeOfCriticalSectionToUse & juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getLock ( ) const
inlinenoexcept

Returns the CriticalSection that locks this array. To lock, you can call getLock().enter() and getLock().exit(), or preferably use an object of ScopedLockType as an RAII lock for it.

Definition at line 1120 of file juce_Array.h.

Referenced by juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::addArray(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::addArray(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addArray(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::addCopiesOf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addIfNotAlreadyThere(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::addSet(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addSorted(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::ListenerList< ListenerClass, ArrayType >::call(), juce::ListenerList< ListenerClass, ArrayType >::callChecked(), juce::ListenerList< ListenerClass, ArrayType >::callCheckedExcluding(), juce::ListenerList< ListenerClass, ArrayType >::callExcluding(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::clear(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::clearQuick(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::contains(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::ensureStorageAllocated(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::fill(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getFirst(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getLast(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::getLock(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getReference(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getReference(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getUnchecked(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::indexOf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOfSorted(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::insert(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::insertArray(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::insertMultiple(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::minimiseStorageOverheads(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::move(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator==(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::operator==(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator[](), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::ReferenceCountedArray(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::ReferenceCountedArray(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeAllInstancesOf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeAndReturn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeFirstMatchingValue(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeIf(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeLast(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeRange(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesIn(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValuesIn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesNotIn(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValuesNotIn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::set(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::setUnchecked(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::size(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::sort(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::swap(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::swapWith(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::swapWith(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::swapWith(), and juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::swapWith().

◆ getRawDataPointer() [1/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
const ElementType * juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getRawDataPointer ( ) const
inlinenoexcept

Returns a pointer to the actual array data. This pointer will only be valid until the next time a non-const method is called on the array.

Definition at line 319 of file juce_Array.h.

◆ getRawDataPointer() [2/2]

◆ getReference() [1/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
const ElementType & juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getReference ( int  index) const
inlinenoexcept

Returns a direct reference to one of the elements in the array, without checking the index passed in.

This is like getUnchecked, but returns a direct reference to the element. Obviously this can be dangerous, so only use it when absolutely necessary.

Parameters
indexthe index of the element being requested (0 is the first element in the array)
See also
operator[], getFirst, getLast

Definition at line 281 of file juce_Array.h.

◆ getReference() [2/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType & juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getReference ( int  index)
inlinenoexcept

Returns a direct reference to one of the elements in the array, without checking the index passed in.

This is like getUnchecked, but returns a direct reference to the element, so that you can alter it directly. Obviously this can be dangerous, so only use it when absolutely necessary.

Parameters
indexthe index of the element being requested (0 is the first element in the array)
See also
operator[], getFirst, getLast

Definition at line 267 of file juce_Array.h.

Referenced by juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::add(), juce::StringArray::addArray(), juce::StringArray::appendNumbersToDuplicates(), juce::ReadWriteLock::exitRead(), juce::BigInteger::extendedEuclidean(), juce::IPAddress::getFormattedAddress(), juce::MPEInstrument::getMostRecentNoteOtherThan(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::getReference(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::getReference(), juce::NamedValueSet::getValueAt(), juce::ArgumentList::getValueForOption(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::indexOf(), juce::StringArray::indexOf(), juce::ArgumentList::indexOfOption(), juce::dsp::ConvolutionEngine::initializeConvolutionEngine(), juce::StringArray::joinIntoString(), juce::dsp::Matrix< ElementType >::operator()(), juce::dsp::Matrix< ElementType >::operator()(), juce::NamedValueSet::operator==(), juce::StringArray::operator[](), juce::dsp::Polynomial< FloatingType >::operator[](), juce::MPEInstrument::polyAftertouch(), juce::dsp::ConvolutionEngine::processSamples(), juce::MPEInstrument::releaseAllNotes(), juce::NamedValueSet::remove(), juce::StringArray::removeDuplicates(), juce::StringArray::removeEmptyStrings(), juce::AudioDeviceManager::removeMidiInputDeviceCallback(), juce::SparseSet< Type >::removeRange(), juce::StringArray::removeString(), juce::ArgumentList::removeValueForOption(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValuesIn(), and juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValuesNotIn().

◆ getUnchecked()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getUnchecked ( int  index) const
inline

Returns one of the elements in the array, without checking the index passed in.

Unlike the operator[] method, this will try to return an element without checking that the index is within the bounds of the array, so should only be used when you're confident that it will always be a valid index.

Parameters
indexthe index of the element being requested (0 is the first element in the array)
See also
operator[], getFirst, getLast

Definition at line 252 of file juce_Array.h.

Referenced by juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::addCopiesOf(), juce::URL::addEscapeChars(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::clear(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::containsValue(), juce::MidiMessageSequence::createControllerUpdatesForTime(), juce::ChannelRemappingAudioSource::createXml(), juce::DeletedAtShutdown::deleteAll(), juce::ZipFile::getIndexOfFileName(), juce::IIRFilterAudioSource::getNextAudioBlock(), juce::MixerAudioSource::getNextAudioBlock(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::getReference(), juce::ChannelRemappingAudioSource::getRemappedInputChannel(), juce::ChannelRemappingAudioSource::getRemappedOutputChannel(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::getUnchecked(), juce::dsp::LookupTable< FloatType >::getUnchecked(), juce::IIRFilterAudioSource::makeInactive(), juce::MidiMessageSequence::MidiMessageSequence(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::Iterator::next(), juce::MPESynthesiser::noteReleased(), juce::dsp::Polynomial< FloatingType >::operator()(), juce::dsp::Polynomial< FloatingType >::operator[](), juce::IIRFilterAudioSource::prepareToPlay(), juce::MixerAudioSource::prepareToPlay(), juce::dsp::Convolution::Pimpl::processFifo(), juce::dsp::Oversampling< SampleType >::processSamplesDown(), juce::dsp::Oversampling< SampleType >::processSamplesUp(), juce::MixerAudioSource::releaseResources(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remapTable(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remove(), juce::MixerAudioSource::removeAllInputs(), juce::ThreadPool::removeAllJobs(), juce::URL::removeEscapeChars(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::removeValue(), juce::ActionBroadcaster::sendActionMessage(), juce::AudioDeviceManager::setAudioDeviceSetup(), juce::IIRFilterAudioSource::setCoefficients(), juce::AudioDeviceManager::setCurrentAudioDeviceType(), juce::MPESynthesiser::setCurrentPlaybackSampleRate(), juce::AudioDeviceManager::setDefaultMidiOutputDevice(), and juce::MidiMessageSequence::updateMatchedPairs().

◆ indexOf()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
int juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOf ( ParameterType  elementToLookFor) const
inline

◆ indexOfSorted()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
int juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOfSorted ( ElementComparator comparator,
TargetValueType  elementToLookFor 
) const
inline

Finds the index of an element in the array, assuming that the array is sorted.

This will use a comparator to do a binary-chop to find the index of the given element, if it exists. If the array isn't sorted, the behaviour of this method will be unpredictable.

Parameters
comparatorthe comparator to use to compare the elements - see the sort() method for details about the form this object should take
elementToLookForthe element to search for
Returns
the index of the element, or -1 if it's not found
See also
addSorted, sort

Definition at line 730 of file juce_Array.h.

◆ insert()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::insert ( int  indexToInsertAt,
ParameterType  newElement 
)
inline

Inserts a new element into the array at a given position.

If the index is less than 0 or greater than the size of the array, the element will be added to the end of the array. Otherwise, it will be inserted into the array, moving all the later elements along to make room.

Parameters
indexToInsertAtthe index at which the new element should be inserted (pass in -1 to add it to the end)
newElementthe new object to add to the array
See also
add, addSorted, addUsingDefaultSort, set

Definition at line 462 of file juce_Array.h.

Referenced by juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::add(), juce::URL::addEscapeChars(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addSorted(), juce::dsp::FilterDesign< FloatType >::designFIRLowpassHalfBandEquirippleMethod(), juce::var::insert(), juce::StringArray::insert(), juce::IPAddress::IPAddress(), and juce::SparseSet< Type >::removeRange().

◆ insertArray()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::insertArray ( int  indexToInsertAt,
const ElementType *  newElements,
int  numberOfElements 
)
inline

Inserts an array of values into this array at a given position.

If the index is less than 0 or greater than the size of the array, the new elements will be added to the end of the array. Otherwise, they will be inserted into the array, moving all the later elements along to make room.

Parameters
indexToInsertAtthe index at which the first new element should be inserted
newElementsthe new values to add to the array
numberOfElementshow many items are in the array
See also
insert, add, addSorted, set

Definition at line 502 of file juce_Array.h.

◆ insertMultiple()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::insertMultiple ( int  indexToInsertAt,
ParameterType  newElement,
int  numberOfTimesToInsertIt 
)
inline

Inserts multiple copies of an element into the array at a given position.

If the index is less than 0 or greater than the size of the array, the element will be added to the end of the array. Otherwise, it will be inserted into the array, moving all the later elements along to make room.

Parameters
indexToInsertAtthe index at which the new element should be inserted
newElementthe new object to add to the array
numberOfTimesToInsertIthow many copies of the value to insert
See also
insert, add, addSorted, set

Definition at line 480 of file juce_Array.h.

Referenced by juce::MidiBuffer::addEvent(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::HashMap(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remapTable(), and juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::resize().

◆ isEmpty()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
bool juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::isEmpty ( ) const
inlinenoexcept

Returns true if the array is empty, false otherwise.

Definition at line 222 of file juce_Array.h.

Referenced by juce::StringArray::addLines(), juce::ValueTree::addListener(), juce::SparseSet< Type >::addRange(), juce::StringArray::addTokens(), juce::String::appendCharPointer(), juce::String::appendCharPointer(), juce::String::containsAnyOf(), juce::String::containsNonWhitespaceChars(), juce::String::containsOnly(), juce::CharacterFunctions::find(), juce::Synthesiser::findVoiceToSteal(), juce::MemoryBlock::fromBase64Encoding(), juce::XmlElement::getChildByAttribute(), juce::XmlElement::getChildByName(), juce::RelativeTime::getDescription(), juce::SystemStats::getDeviceIdentifiers(), juce::StringPool::getPooledString(), juce::StringPool::getPooledString(), juce::SparseSet< Type >::getTotalRange(), juce::File::hasFileExtension(), juce::String::indexOf(), juce::String::indexOf(), juce::String::indexOfAnyOf(), juce::String::indexOfChar(), juce::String::indexOfIgnoreCase(), juce::String::indexOfIgnoreCase(), juce::String::initialSectionContainingOnly(), juce::String::initialSectionNotContaining(), juce::File::isAChildOf(), juce::ListenerList< ListenerClass, ArrayType >::isEmpty(), juce::NamedValueSet::isEmpty(), juce::SparseSet< Type >::isEmpty(), juce::URL::isEmpty(), juce::String::isEmpty(), juce::StringRef::isEmpty(), juce::String::isNotEmpty(), juce::StringRef::isNotEmpty(), juce::Identifier::isNull(), juce::XmlElement::isTextElement(), juce::String::lastIndexOfAnyOf(), juce::String::lastIndexOfChar(), juce::MPEChannelAssigner::MPEChannelAssigner(), juce::MPEInstrument::noteOff(), juce::Result::operator bool(), juce::ValueTree::operator=(), juce::dsp::Polynomial< FloatingType >::Polynomial(), juce::dsp::Polynomial< FloatingType >::Polynomial(), juce::ValueTree::removeListener(), juce::SparseSet< Type >::removeRange(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValuesIn(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValuesNotIn(), juce::String::replaceSection(), juce::AudioDeviceManager::setAudioDeviceSetup(), juce::String::substring(), juce::String::substring(), juce::ZipFile::uncompressEntry(), juce::Result::wasOk(), and juce::ValueTree::~ValueTree().

◆ minimiseStorageAfterRemoval()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::minimiseStorageAfterRemoval ( )
inline

Definition at line 1143 of file juce_Array.h.

◆ minimiseStorageOverheads()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::minimiseStorageOverheads ( )
inline

Reduces the amount of storage being used by the array.

Arrays typically allocate slightly more storage than they need, and after removing elements, they may have quite a lot of unused space allocated. This method will reduce the amount of allocated storage to a minimum.

Definition at line 1050 of file juce_Array.h.

Referenced by juce::StringArray::minimiseStorageOverheads(), and juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::minimiseStorageOverheads().

◆ move()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::move ( int  currentIndex,
int  newIndex 
)
inlinenoexcept

Moves one of the values to a different position.

This will move the value to a specified index, shuffling along any intervening elements as required.

So for example, if you have the array { 0, 1, 2, 3, 4, 5 } then calling move (2, 4) would result in { 0, 1, 3, 4, 2, 5 }.

Parameters
currentIndexthe index of the value to be moved. If this isn't a valid index, then nothing will be done
newIndexthe index at which you'd like this value to end up. If this is less than zero, the value will be moved to the end of the array

Definition at line 1034 of file juce_Array.h.

Referenced by juce::StringArray::move().

◆ operator!=()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<class OtherArrayType >
bool juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator!= ( const OtherArrayType other) const
inline

Compares this array to another one. Two arrays are considered equal if they both contain the same set of elements, in the same order.

Parameters
otherthe other array to compare with

Definition at line 175 of file juce_Array.h.

◆ operator=() [1/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
Array & juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator= ( Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize > &&  other)
inlinenoexcept

Definition at line 148 of file juce_Array.h.

◆ operator=() [2/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
Array & juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator= ( const Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize > &  other)
inline

Copies another array.

Parameters
otherthe array to copy

Definition at line 137 of file juce_Array.h.

◆ operator==()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<class OtherArrayType >
bool juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator== ( const OtherArrayType other) const
inline

Compares this array to another one. Two arrays are considered equal if they both contain the same set of elements, in the same order.

Parameters
otherthe other array to compare with

Definition at line 162 of file juce_Array.h.

Referenced by juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator!=().

◆ operator[]()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::operator[] ( int  index) const
inline

Returns one of the elements in the array. If the index passed in is beyond the range of valid elements, this will return a default value.

If you're certain that the index will always be a valid element, you can call getUnchecked() instead, which is faster.

Parameters
indexthe index of the element being requested (0 is the first element in the array)
See also
getUnchecked, getFirst, getLast

Definition at line 237 of file juce_Array.h.

◆ remove() [1/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove ( const ElementType *  elementToRemove)
inline

Removes an element from the array.

This will remove the element pointed to by the given iterator, and move back all the subsequent elements to close the gap. If the iterator passed in does not point to an element within the array, behaviour is undefined.

Parameters
elementToRemovea pointer to the element to remove
See also
removeFirstMatchingValue, removeAllInstancesOf, removeRange, removeIf

Definition at line 809 of file juce_Array.h.

◆ remove() [2/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove ( int  indexToRemove)
inline

Removes an element from the array.

This will remove the element at a given index, and move back all the subsequent elements to close the gap. If the index passed in is out-of-range, nothing will happen.

Parameters
indexToRemovethe index of the element to remove
See also
removeAndReturn, removeFirstMatchingValue, removeAllInstancesOf, removeRange

Definition at line 767 of file juce_Array.h.

Referenced by juce::MidiMessageSequence::deleteMidiChannelMessages(), juce::MidiMessageSequence::deleteSysExMessages(), juce::ReadWriteLock::exitRead(), juce::MPEInstrument::noteOff(), juce::MPEInstrument::noteOn(), juce::MPESynthesiser::reduceNumVoices(), juce::NamedValueSet::remove(), juce::var::remove(), juce::StringArray::remove(), juce::ThreadPool::removeAllJobs(), juce::AudioDeviceManager::removeAudioDeviceType(), juce::ChangeBroadcaster::removeChangeListener(), juce::StringArray::removeDuplicates(), juce::StringArray::removeEmptyStrings(), juce::MixerAudioSource::removeInputSource(), juce::Thread::removeListener(), juce::MPEZoneLayout::removeListener(), juce::Value::removeListener(), juce::ValueTree::removeListener(), juce::MPEInstrument::removeListener(), juce::ThreadPoolJob::removeListener(), juce::AudioDeviceManager::removeMidiInputDeviceCallback(), juce::ArgumentList::removeOptionIfFound(), juce::SparseSet< Type >::removeRange(), juce::Synthesiser::removeSound(), juce::StringArray::removeString(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValue(), juce::ArgumentList::removeValueForOption(), juce::MPESynthesiser::removeVoice(), and juce::Synthesiser::removeVoice().

◆ removeAllInstancesOf()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
int juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeAllInstancesOf ( ParameterType  valueToRemove)
inline

Removes items from the array.

This will remove all occurrences of the given element from the array. If no such items are found, no action is taken.

Parameters
valueToRemovethe object to try to remove
Returns
how many objects were removed.
See also
remove, removeRange, removeIf

Definition at line 858 of file juce_Array.h.

Referenced by juce::MPEChannelAssigner::noteOff().

◆ removeAndReturn()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
ElementType juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeAndReturn ( int  indexToRemove)
inline

Removes an element from the array.

This will remove the element at a given index, and move back all the subsequent elements to close the gap. If the index passed in is out-of-range, nothing will happen.

Parameters
indexToRemovethe index of the element to remove
Returns
the element that has been removed
See also
removeFirstMatchingValue, removeAllInstancesOf, removeRange

Definition at line 785 of file juce_Array.h.

Referenced by juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::remove(), and juce::AudioDeviceManager::removeAudioDeviceType().

◆ removeFirstMatchingValue()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeFirstMatchingValue ( ParameterType  valueToRemove)
inline

Removes an item from the array.

This will remove the first occurrence of the given element from the array. If the item isn't found, no action is taken.

Parameters
valueToRemovethe object to try to remove
See also
remove, removeRange, removeIf

Definition at line 834 of file juce_Array.h.

Referenced by juce::ListenerList< ListenerClass, ArrayType >::remove(), juce::AudioDeviceManager::removeAudioCallback(), juce::ThreadPool::removeJob(), juce::MidiKeyboardState::removeListener(), juce::TimeSliceThread::removeTimeSliceClient(), juce::TimeSliceThread::run(), juce::DeletedAtShutdown::~DeletedAtShutdown(), juce::OutputStream::~OutputStream(), and juce::UnitTest::~UnitTest().

◆ removeIf()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<typename PredicateType >
int juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeIf ( PredicateType &&  predicate)
inline

Removes items from the array.

This will remove all objects from the array that match a condition. If no such items are found, no action is taken.

Parameters
predicatethe condition when to remove an item. Must be a callable type that takes an ElementType and returns a bool
Returns
how many objects were removed.
See also
remove, removeRange, removeAllInstancesOf

Definition at line 887 of file juce_Array.h.

◆ removeLast()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeLast ( int  howManyToRemove = 1)
inline

Removes the last n elements from the array.

Parameters
howManyToRemovehow many elements to remove from the end of the array
See also
remove, removeFirstMatchingValue, removeAllInstancesOf, removeRange

Definition at line 936 of file juce_Array.h.

Referenced by juce::UndoManager::perform().

◆ removeRange()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeRange ( int  startIndex,
int  numberToRemove 
)
inline

Removes a range of elements from the array.

This will remove a set of elements, starting from the given index, and move subsequent elements down to close the gap.

If the range extends beyond the bounds of the array, it will be safely clipped to the size of the array.

Parameters
startIndexthe index of the first element to remove
numberToRemovehow many elements should be removed
See also
remove, removeFirstMatchingValue, removeAllInstancesOf, removeIf

Definition at line 916 of file juce_Array.h.

Referenced by juce::MidiBuffer::clear(), juce::SparseSet< Type >::invertRange(), juce::URL::removeEscapeChars(), juce::StringArray::removeRange(), juce::ArgumentList::removeValueForOption(), and juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::resize().

◆ removeValuesIn()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<class OtherArrayType >
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesIn ( const OtherArrayType otherArray)
inline

Removes any elements which are also in another array.

Parameters
otherArraythe other array in which to look for elements to remove
See also
removeValuesNotIn, remove, removeFirstMatchingValue, removeAllInstancesOf, removeRange

Definition at line 958 of file juce_Array.h.

◆ removeValuesNotIn()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
template<class OtherArrayType >
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesNotIn ( const OtherArrayType otherArray)
inline

Removes any elements which are not found in another array.

Only elements which occur in this other array will be retained.

Parameters
otherArraythe array in which to look for elements NOT to remove
See also
removeValuesIn, remove, removeFirstMatchingValue, removeAllInstancesOf, removeRange

Definition at line 986 of file juce_Array.h.

◆ resize()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::resize ( int  targetNumItems)
inline

This will enlarge or shrink the array to the given number of elements, by adding or removing items from its end.

If the array is smaller than the given target size, empty elements will be appended until its size is as specified. If its size is larger than the target, items will be removed from its end to shorten it.

Definition at line 670 of file juce_Array.h.

Referenced by juce::dsp::FIR::Coefficients< NumericType >::Coefficients(), juce::dsp::WindowingFunction< FloatType >::fillWindowingTables(), juce::dsp::LookupTable< FloatType >::initialise(), juce::dsp::Oscillator< SampleType >::prepare(), and juce::var::resize().

◆ set()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::set ( int  indexToChange,
ParameterType  newValue 
)
inline

◆ setUnchecked()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::setUnchecked ( int  indexToChange,
ParameterType  newValue 
)
inline

Replaces an element with a new value without doing any bounds-checking.

This just sets a value directly in the array's internal storage, so you'd better make sure it's in range!

Parameters
indexToChangethe index whose value you want to change
newValuethe new value to set for this index.
See also
set, getUnchecked

Definition at line 568 of file juce_Array.h.

Referenced by juce::dsp::Convolution::Pimpl::addToFifo(), juce::dsp::Convolution::Pimpl::addToFifo(), juce::dsp::FilterDesign< FloatType >::designFIRLowpassHalfBandEquirippleMethod(), and juce::dsp::Convolution::Pimpl::processFifo().

◆ size()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
int juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::size ( ) const
inlinenoexcept

Returns the current number of elements in the array.

Definition at line 215 of file juce_Array.h.

Referenced by juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::add(), juce::StringArray::addArray(), juce::StringPairArray::addArray(), juce::AudioDeviceManager::addAudioDeviceType(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::addCopiesOf(), juce::URL::addEscapeChars(), juce::MixerAudioSource::addInputSource(), juce::Value::addListener(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::addOrReplaceSorted(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::addSet(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::addSorted(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::addSorted(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::addSorted(), juce::MPEChannelAssigner::allNotesOff(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::Array(), juce::AudioBuffer< Type >::AudioBuffer(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::clear(), juce::dsp::Matrix< ElementType >::clear(), juce::AudioBuffer< Type >::copyFrom(), juce::MidiMessageSequence::createControllerUpdatesForTime(), juce::ChannelRemappingAudioSource::createXml(), juce::DeletedAtShutdown::deleteAll(), juce::MidiMessageSequence::deleteEvent(), juce::MidiMessageSequence::deleteMidiChannelMessages(), juce::MidiMessageSequence::deleteSysExMessages(), juce::dsp::FilterDesign< FloatType >::designFIRLowpassHalfBandEquirippleMethod(), juce::ReadWriteLock::exitRead(), juce::BigInteger::extendedEuclidean(), juce::MPESynthesiser::findVoiceToSteal(), juce::Synthesiser::findVoiceToSteal(), juce::RelativeTime::getDescription(), juce::dsp::FIR::Coefficients< NumericType >::getFilterOrder(), juce::MidiBuffer::getFirstEventTime(), juce::IPAddress::getFormattedAddress(), juce::MidiBuffer::getLastEventTime(), juce::IIRFilterAudioSource::getNextAudioBlock(), juce::MixerAudioSource::getNextAudioBlock(), juce::MidiMessageSequence::getNextIndexAtTime(), juce::UndoManager::getNumActionsInCurrentTransaction(), juce::ValueTree::getNumChildren(), juce::TimeSliceThread::getNumClients(), juce::MidiMessageSequence::getNumEvents(), juce::ThreadPool::getNumJobs(), juce::AudioFormatManager::getNumKnownFormats(), juce::MPEInstrument::getNumPlayingNotes(), juce::dsp::LookupTable< FloatType >::getNumPoints(), juce::ValueTree::getNumProperties(), juce::SparseSet< Type >::getNumRanges(), juce::UnitTestRunner::getNumResults(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::getNumSlots(), juce::Synthesiser::getNumSounds(), juce::MidiFile::getNumTracks(), juce::MPESynthesiser::getNumVoices(), juce::Synthesiser::getNumVoices(), juce::dsp::Polynomial< FloatingType >::getOrder(), juce::dsp::Polynomial< FloatingType >::getProductWith(), juce::ChannelRemappingAudioSource::getRemappedInputChannel(), juce::ChannelRemappingAudioSource::getRemappedOutputChannel(), juce::dsp::Polynomial< FloatingType >::getSumWith(), juce::ArgumentList::getValueForOption(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::indexOf(), juce::NamedValueSet::indexOf(), juce::ArgumentList::indexOfOption(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::indexOfSorted(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::indexOfSorted(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOfSorted(), juce::IPAddress::IPAddress(), juce::MidiBuffer::isEmpty(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::isEmpty(), juce::dsp::LookupTable< FloatType >::isInitialised(), juce::IIRFilterAudioSource::makeInactive(), juce::MidiMessage::MidiMessage(), juce::MPESynthesiser::noteReleased(), juce::dsp::Polynomial< FloatingType >::operator()(), juce::AudioBuffer< Type >::operator=(), juce::MemoryBlock::operator=(), juce::MidiMessage::operator=(), juce::MemoryBlock::operator=(), juce::MidiMessage::operator=(), juce::Value::operator=(), juce::MemoryBlock::operator==(), juce::NamedValueSet::operator==(), juce::StringPairArray::operator==(), juce::var::operator[](), juce::var::operator[](), juce::MPEInstrument::polyAftertouch(), juce::IIRFilterAudioSource::prepareToPlay(), juce::MixerAudioSource::prepareToPlay(), juce::dsp::Oscillator< SampleType >::process(), juce::MPESynthesiser::reduceNumVoices(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::ReferenceCountedArray(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::ReferenceCountedArray(), juce::Value::referTo(), juce::MPEInstrument::releaseAllNotes(), juce::MixerAudioSource::releaseResources(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove(), juce::NamedValueSet::remove(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::remove(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::remove(), juce::MixerAudioSource::removeAllInputs(), juce::ThreadPool::removeAllJobs(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeAndReturn(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeAndReturn(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeAndReturn(), juce::AudioDeviceManager::removeAudioDeviceType(), juce::ChangeBroadcaster::removeChangeListener(), juce::URL::removeEscapeChars(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeLast(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeLast(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeLast(), juce::Value::removeListener(), juce::AudioDeviceManager::removeMidiInputDeviceCallback(), juce::SparseSet< Type >::removeRange(), juce::ArgumentList::removeValueForOption(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesIn(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValuesIn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeValuesNotIn(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::removeValuesNotIn(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::resize(), juce::ChannelRemappingAudioSource::restoreFromXml(), juce::TimeSliceThread::run(), juce::ActionBroadcaster::sendActionMessage(), juce::Value::ValueSource::sendChangeMessage(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::set(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::set(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::set(), juce::AudioDeviceManager::setAudioDeviceSetup(), juce::IIRFilterAudioSource::setCoefficients(), juce::AudioDeviceManager::setCurrentAudioDeviceType(), juce::MPESynthesiser::setCurrentPlaybackSampleRate(), juce::AudioDeviceManager::setDefaultMidiOutputDevice(), juce::ChannelRemappingAudioSource::setInputChannelMapping(), juce::ChannelRemappingAudioSource::setOutputChannelMapping(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::setUnchecked(), juce::var::size(), juce::ArgumentList::size(), juce::ListenerList< ListenerClass, ArrayType >::size(), juce::NamedValueSet::size(), juce::OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::size(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::size(), juce::SortedSet< ElementType, TypeOfCriticalSectionToUse >::size(), juce::StringArray::size(), juce::StringPairArray::size(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::sort(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::swap(), juce::MemoryBlock::swapWith(), juce::MidiMessageSequence::updateMatchedPairs(), juce::Value::Value(), juce::URL::withParameters(), juce::DynamicObject::writeAsJSON(), juce::ZipFile::Builder::writeToStream(), and juce::ReadWriteLock::~ReadWriteLock().

◆ sort() [1/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::sort ( )
inline

Sorts the array using a default comparison operation. If the type of your elements isn't supported by the DefaultElementComparator class then you may need to use the other version of sort, which takes a custom comparator.

Definition at line 1073 of file juce_Array.h.

Referenced by juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::sort(), and juce::ValueTree::sort().

◆ sort() [2/2]

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::sort ( ElementComparator comparator,
bool  retainOrderOfEquivalentItems = false 
)
inline

Sorts the elements in the array.

This will use a comparator object to sort the elements into order. The object passed must have a method of the form:

int compareElements (ElementType first, ElementType second);

..and this method must return:

  • a value of < 0 if the first comes before the second
  • a value of 0 if the two objects are equivalent
  • a value of > 0 if the second comes before the first

To improve performance, the compareElements() method can be declared as static or const.

Parameters
comparatorthe comparator to use for comparing elements.
retainOrderOfEquivalentItemsif this is true, then items which the comparator says are equivalent will be kept in the order in which they currently appear in the array. This is slower to perform, but may be important in some cases. If it's false, a faster algorithm is used, but equivalent elements may be rearranged.
See also
addSorted, indexOfSorted, sortArray

Definition at line 1106 of file juce_Array.h.

◆ swap()

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::swap ( int  index1,
int  index2 
)
inline

Swaps over two elements in the array.

This swaps over the elements found at the two indexes passed in. If either index is out-of-range, this method will do nothing.

Parameters
index1index of one of the elements to swap
index2index of the other element to swap

Definition at line 1014 of file juce_Array.h.

◆ swapWith()

Member Data Documentation

◆ removeInternal

template<typename ElementType , typename TypeOfCriticalSectionToUse = DummyCriticalSection, int minimumAllocatedSize = 0>
JUCE_DEPRECATED_WITH_BODY(void swapWithArray(Array &other) noexcept, { swapWith(other);}) private void juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeInternal(int indexToRemove)
inline

Definition at line 1137 of file juce_Array.h.


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