OpenShot Audio Library | OpenShotAudio: juce_Array.h Source File

OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_Array.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
52template <typename ElementType,
53 typename TypeOfCriticalSectionToUse = DummyCriticalSection,
54 int minimumAllocatedSize = 0>
55 class Array
56{
57private:
58 using ParameterType = typename TypeHelpers::ParameterType<ElementType>::type;
59
60public:
61 //==============================================================================
63 Array() = default;
64
68 Array (const Array& other)
69 {
70 const ScopedLockType lock (other.getLock());
71 values.addArray (other.values.begin(), other.values.size());
72 }
73
74 Array (Array&& other) noexcept
75 : values (std::move (other.values))
76 {
77 }
78
82 template <typename TypeToCreateFrom>
83 explicit Array (const TypeToCreateFrom* data)
84 {
85 while (*values != TypeToCreateFrom())
86 add (*data++);
87 }
88
93 template <typename TypeToCreateFrom>
94 Array (const TypeToCreateFrom* data, int numValues)
95 {
96 values.addArray (data, numValues);
97 }
98
100 Array (const ElementType& singleElementToAdd)
101 {
102 add (singleElementToAdd);
103 }
104
106 Array (ElementType&& singleElementToAdd)
107 {
108 add (std::move (singleElementToAdd));
109 }
110
112 template <typename... OtherElements>
113 Array (const ElementType& firstNewElement, OtherElements&&... otherElements)
114 {
115 values.add (firstNewElement, std::forward<OtherElements> (otherElements)...);
116 }
117
119 template <typename... OtherElements>
120 Array (ElementType&& firstNewElement, OtherElements&&... otherElements)
121 {
122 values.add (std::move (firstNewElement), std::forward<OtherElements> (otherElements)...);
123 }
124
125 template <typename TypeToCreateFrom>
126 Array (const std::initializer_list<TypeToCreateFrom>& items)
127 {
128 addArray (items);
129 }
130
132 ~Array() = default;
133
137 Array& operator= (const Array& other)
138 {
139 if (this != &other)
140 {
141 auto otherCopy (other);
142 swapWith (otherCopy);
143 }
144
145 return *this;
146 }
147
148 Array& operator= (Array&& other) noexcept
149 {
150 const ScopedLockType lock (getLock());
151 values = std::move (other.values);
152 return *this;
153 }
154
155 //==============================================================================
161 template <class OtherArrayType>
162 bool operator== (const OtherArrayType& other) const
163 {
164 const ScopedLockType lock (getLock());
165 const typename OtherArrayType::ScopedLockType lock2 (other.getLock());
166 return values == other;
167 }
168
174 template <class OtherArrayType>
175 bool operator!= (const OtherArrayType& other) const
176 {
177 return ! operator== (other);
178 }
179
180 //==============================================================================
188 void clear()
189 {
190 const ScopedLockType lock (getLock());
191 clearQuick();
192 values.setAllocatedSize (0);
193 }
194
198 void clearQuick()
199 {
200 const ScopedLockType lock (getLock());
201 values.clear();
202 }
203
205 void fill (const ParameterType& newValue) noexcept
206 {
207 const ScopedLockType lock (getLock());
208
209 for (auto& e : *this)
210 e = newValue;
211 }
212
213 //==============================================================================
215 inline int size() const noexcept
216 {
217 const ScopedLockType lock (getLock());
218 return values.size();
219 }
220
222 inline bool isEmpty() const noexcept
223 {
224 return size() == 0;
225 }
226
237 ElementType operator[] (int index) const
238 {
239 const ScopedLockType lock (getLock());
240 return values.getValueWithDefault (index);
241 }
242
252 inline ElementType getUnchecked (int index) const
253 {
254 const ScopedLockType lock (getLock());
255 return values[index];
256 }
257
267 inline ElementType& getReference (int index) noexcept
268 {
269 const ScopedLockType lock (getLock());
270 return values[index];
271 }
272
281 inline const ElementType& getReference (int index) const noexcept
282 {
283 const ScopedLockType lock (getLock());
284 return values[index];
285 }
286
290 inline ElementType getFirst() const noexcept
291 {
292 const ScopedLockType lock (getLock());
293 return values.getFirst();
294 }
295
300 inline ElementType getLast() const noexcept
301 {
302 const ScopedLockType lock (getLock());
303 return values.getLast();
304 }
305
310 inline ElementType* getRawDataPointer() noexcept
311 {
312 return values.begin();
313 }
314
319 inline const ElementType* getRawDataPointer() const noexcept
320 {
321 return values.begin();
322 }
323
324 //==============================================================================
328 inline ElementType* begin() noexcept
329 {
330 return values.begin();
331 }
332
336 inline const ElementType* begin() const noexcept
337 {
338 return values.begin();
339 }
340
344 inline ElementType* end() noexcept
345 {
346 return values.end();
347 }
348
352 inline const ElementType* end() const noexcept
353 {
354 return values.end();
355 }
356
360 inline ElementType* data() noexcept
361 {
362 return begin();
363 }
364
368 inline const ElementType* data() const noexcept
369 {
370 return begin();
371 }
372
373 //==============================================================================
382 int indexOf (ParameterType elementToLookFor) const
383 {
384 const ScopedLockType lock (getLock());
385 auto e = values.begin();
386 auto endPtr = values.end();
387
388 for (; e != endPtr; ++e)
389 if (exactlyEqual (elementToLookFor, *e))
390 return static_cast<int> (e - values.begin());
391
392 return -1;
393 }
394
400 bool contains (ParameterType elementToLookFor) const
401 {
402 const ScopedLockType lock (getLock());
403 auto e = values.begin();
404 auto endPtr = values.end();
405
406 for (; e != endPtr; ++e)
407 if (exactlyEqual (elementToLookFor, *e))
408 return true;
409
410 return false;
411 }
412
413 //==============================================================================
418 void add (const ElementType& newElement)
419 {
420 const ScopedLockType lock (getLock());
421 values.add (newElement);
422 }
423
428 void add (ElementType&& newElement)
429 {
430 const ScopedLockType lock (getLock());
431 values.add (std::move (newElement));
432 }
433
435 template <typename... OtherElements>
436 void add (const ElementType& firstNewElement, OtherElements&&... otherElements)
437 {
438 const ScopedLockType lock (getLock());
439 values.add (firstNewElement, std::forward<OtherElements> (otherElements)...);
440 }
441
443 template <typename... OtherElements>
444 void add (ElementType&& firstNewElement, OtherElements&&... otherElements)
445 {
446 const ScopedLockType lock (getLock());
447 values.add (std::move (firstNewElement), std::forward<OtherElements> (otherElements)...);
448 }
449
462 void insert (int indexToInsertAt, ParameterType newElement)
463 {
464 const ScopedLockType lock (getLock());
465 values.insert (indexToInsertAt, newElement, 1);
466 }
467
480 void insertMultiple (int indexToInsertAt, ParameterType newElement,
481 int numberOfTimesToInsertIt)
482 {
483 if (numberOfTimesToInsertIt > 0)
484 {
485 const ScopedLockType lock (getLock());
486 values.insert (indexToInsertAt, newElement, numberOfTimesToInsertIt);
487 }
488 }
489
502 void insertArray (int indexToInsertAt,
503 const ElementType* newElements,
504 int numberOfElements)
505 {
506 if (numberOfElements > 0)
507 {
508 const ScopedLockType lock (getLock());
509 values.insertArray (indexToInsertAt, newElements, numberOfElements);
510 }
511 }
512
522 bool addIfNotAlreadyThere (ParameterType newElement)
523 {
524 const ScopedLockType lock (getLock());
525
526 if (contains (newElement))
527 return false;
528
529 add (newElement);
530 return true;
531 }
532
542 void set (int indexToChange, ParameterType newValue)
543 {
544 if (indexToChange >= 0)
545 {
546 const ScopedLockType lock (getLock());
547
548 if (indexToChange < values.size())
549 values[indexToChange] = newValue;
550 else
551 values.add (newValue);
552 }
553 else
554 {
555 jassertfalse;
556 }
557 }
558
568 void setUnchecked (int indexToChange, ParameterType newValue)
569 {
570 const ScopedLockType lock (getLock());
571 jassert (isPositiveAndBelow (indexToChange, values.size()));
572 values[indexToChange] = newValue;
573 }
574
582 template <typename Type>
583 void addArray (const Type* elementsToAdd, int numElementsToAdd)
584 {
585 const ScopedLockType lock (getLock());
586
587 if (numElementsToAdd > 0)
588 values.addArray (elementsToAdd, numElementsToAdd);
589 }
590
591 template <typename TypeToCreateFrom>
592 void addArray (const std::initializer_list<TypeToCreateFrom>& items)
593 {
594 const ScopedLockType lock (getLock());
595 values.addArray (items);
596 }
597
604 template <typename Type>
605 void addNullTerminatedArray (const Type* const* elementsToAdd)
606 {
607 int num = 0;
608
609 for (auto e = elementsToAdd; *e != nullptr; ++e)
610 ++num;
611
612 addArray (elementsToAdd, num);
613 }
614
620 template <class OtherArrayType>
621 void swapWith (OtherArrayType& otherArray) noexcept
622 {
623 const ScopedLockType lock1 (getLock());
624 const typename OtherArrayType::ScopedLockType lock2 (otherArray.getLock());
625 values.swapWith (otherArray.values);
626 }
627
633 template <class OtherArrayType>
634 void addArray (const OtherArrayType& arrayToAddFrom)
635 {
636 const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
637 const ScopedLockType lock2 (getLock());
638
639 values.addArray (arrayToAddFrom);
640 }
641
651 template <class OtherArrayType>
652 std::enable_if_t<! std::is_pointer_v<OtherArrayType>, void>
653 addArray (const OtherArrayType& arrayToAddFrom,
654 int startIndex,
655 int numElementsToAdd = -1)
656 {
657 const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
658 const ScopedLockType lock2 (getLock());
659
660 values.addArray (arrayToAddFrom, startIndex, numElementsToAdd);
661 }
662
670 void resize (int targetNumItems)
671 {
672 jassert (targetNumItems >= 0);
673 auto numToAdd = targetNumItems - values.size();
674
675 if (numToAdd > 0)
676 insertMultiple (values.size(), ElementType(), numToAdd);
677 else if (numToAdd < 0)
678 removeRange (targetNumItems, -numToAdd);
679 }
680
693 template <class ElementComparator>
694 int addSorted (ElementComparator& comparator, ParameterType newElement)
695 {
696 const ScopedLockType lock (getLock());
697 auto index = findInsertIndexInSortedArray (comparator, values.begin(), newElement, 0, values.size());
698 insert (index, newElement);
699 return index;
700 }
701
711 void addUsingDefaultSort (ParameterType newElement)
712 {
713 DefaultElementComparator <ElementType> comparator;
714 addSorted (comparator, newElement);
715 }
716
729 template <typename ElementComparator, typename TargetValueType>
730 int indexOfSorted (ElementComparator& comparator, TargetValueType elementToLookFor) const;
731
732 //==============================================================================
742 void remove (int indexToRemove)
743 {
744 const ScopedLockType lock (getLock());
745
746 if (isPositiveAndBelow (indexToRemove, values.size()))
747 removeInternal (indexToRemove);
748 }
749
760 ElementType removeAndReturn (int indexToRemove)
761 {
762 const ScopedLockType lock (getLock());
763
764 if (isPositiveAndBelow (indexToRemove, values.size()))
765 {
766 ElementType removed (values[indexToRemove]);
767 removeInternal (indexToRemove);
768 return removed;
769 }
770
771 return ElementType();
772 }
773
784 void remove (const ElementType* elementToRemove)
785 {
786 jassert (elementToRemove != nullptr);
787 const ScopedLockType lock (getLock());
788
789 jassert (values.begin() != nullptr);
790 auto indexToRemove = (int) (elementToRemove - values.begin());
791
792 if (! isPositiveAndBelow (indexToRemove, values.size()))
793 {
794 jassertfalse;
795 return;
796 }
797
798 removeInternal (indexToRemove);
799 }
800
810 int removeFirstMatchingValue (ParameterType valueToRemove)
811 {
812 const ScopedLockType lock (getLock());
813 auto* e = values.begin();
814
815 for (int i = 0; i < values.size(); ++i)
816 {
817 if (valueToRemove == e[i])
818 {
819 removeInternal (i);
820 return i;
821 }
822 }
823
824 return -1;
825 }
826
836 int removeAllInstancesOf (ParameterType valueToRemove)
837 {
838 int numRemoved = 0;
839 const ScopedLockType lock (getLock());
840
841 for (int i = values.size(); --i >= 0;)
842 {
843 if (valueToRemove == values[i])
844 {
845 removeInternal (i);
846 ++numRemoved;
847 }
848 }
849
850 return numRemoved;
851 }
852
864 template <typename PredicateType>
865 int removeIf (PredicateType&& predicate)
866 {
867 int numRemoved = 0;
868 const ScopedLockType lock (getLock());
869
870 for (int i = values.size(); --i >= 0;)
871 {
872 if (predicate (values[i]))
873 {
874 removeInternal (i);
875 ++numRemoved;
876 }
877 }
878
879 return numRemoved;
880 }
881
894 void removeRange (int startIndex, int numberToRemove)
895 {
896 const ScopedLockType lock (getLock());
897
898 auto endIndex = jlimit (0, values.size(), startIndex + numberToRemove);
899 startIndex = jlimit (0, values.size(), startIndex);
900 numberToRemove = endIndex - startIndex;
901
902 if (numberToRemove > 0)
903 {
904 values.removeElements (startIndex, numberToRemove);
905 minimiseStorageAfterRemoval();
906 }
907 }
908
914 void removeLast (int howManyToRemove = 1)
915 {
916 jassert (howManyToRemove >= 0);
917
918 if (howManyToRemove > 0)
919 {
920 const ScopedLockType lock (getLock());
921
922 if (howManyToRemove > values.size())
923 howManyToRemove = values.size();
924
925 values.removeElements (values.size() - howManyToRemove, howManyToRemove);
926 minimiseStorageAfterRemoval();
927 }
928 }
929
935 template <class OtherArrayType>
936 void removeValuesIn (const OtherArrayType& otherArray)
937 {
938 const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
939 const ScopedLockType lock2 (getLock());
940
941 if (this == &otherArray)
942 {
943 clear();
944 }
945 else
946 {
947 if (otherArray.size() > 0)
948 {
949 for (int i = values.size(); --i >= 0;)
950 if (otherArray.contains (values[i]))
951 removeInternal (i);
952 }
953 }
954 }
955
963 template <class OtherArrayType>
964 void removeValuesNotIn (const OtherArrayType& otherArray)
965 {
966 const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
967 const ScopedLockType lock2 (getLock());
968
969 if (this != &otherArray)
970 {
971 if (otherArray.size() <= 0)
972 {
973 clear();
974 }
975 else
976 {
977 for (int i = values.size(); --i >= 0;)
978 if (! otherArray.contains (values[i]))
979 removeInternal (i);
980 }
981 }
982 }
983
992 void swap (int index1, int index2)
993 {
994 const ScopedLockType lock (getLock());
995 values.swap (index1, index2);
996 }
997
1012 void move (int currentIndex, int newIndex) noexcept
1013 {
1014 if (currentIndex != newIndex)
1015 {
1016 const ScopedLockType lock (getLock());
1017 values.move (currentIndex, newIndex);
1018 }
1019 }
1020
1021 //==============================================================================
1028 void minimiseStorageOverheads()
1029 {
1030 const ScopedLockType lock (getLock());
1031 values.shrinkToNoMoreThan (values.size());
1032 }
1033
1040 void ensureStorageAllocated (int minNumElements)
1041 {
1042 const ScopedLockType lock (getLock());
1043 values.ensureAllocatedSize (minNumElements);
1044 }
1045
1046 //==============================================================================
1051 void sort()
1052 {
1053 DefaultElementComparator<ElementType> comparator;
1054 sort (comparator);
1055 }
1056
1083 template <class ElementComparator>
1084 void sort (ElementComparator& comparator, bool retainOrderOfEquivalentItems = false);
1085
1086 //==============================================================================
1091 inline const TypeOfCriticalSectionToUse& getLock() const noexcept { return values; }
1092
1094 using ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType;
1095
1096
1097 //==============================================================================
1098 #ifndef DOXYGEN
1099 [[deprecated ("This method has been replaced by a more flexible templated version and renamed "
1100 "to swapWith to be more consistent with the names used in other classes.")]]
1101 void swapWithArray (Array& other) noexcept { swapWith (other); }
1102 #endif
1103
1104private:
1105 //==============================================================================
1106 ArrayBase<ElementType, TypeOfCriticalSectionToUse> values;
1107
1108 void removeInternal (int indexToRemove)
1109 {
1110 values.removeElements (indexToRemove, 1);
1111 minimiseStorageAfterRemoval();
1112 }
1113
1114 void minimiseStorageAfterRemoval()
1115 {
1116 if (values.capacity() > jmax (minimumAllocatedSize, values.size() * 2))
1117 values.shrinkToNoMoreThan (jmax (values.size(), jmax (minimumAllocatedSize, 64 / (int) sizeof (ElementType))));
1118 }
1119};
1120
1121//==============================================================================
1122template <typename ElementType, typename TypeOfCriticalSectionToUse, int minimumAllocatedSize>
1123template <typename ElementComparator, typename TargetValueType>
1124 int Array<ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize>::indexOfSorted (
1125 [[maybe_unused]] ElementComparator& comparator,
1126 TargetValueType elementToLookFor) const
1127{
1128 const ScopedLockType lock (getLock());
1129
1130 for (int s = 0, e = values.size();;)
1131 {
1132 if (s >= e)
1133 return -1;
1134
1135 if (comparator.compareElements (elementToLookFor, values[s]) == 0)
1136 return s;
1137
1138 auto halfway = (s + e) / 2;
1139
1140 if (halfway == s)
1141 return -1;
1142
1143 if (comparator.compareElements (elementToLookFor, values[halfway]) >= 0)
1144 s = halfway;
1145 else
1146 e = halfway;
1147 }
1148}
1149
1150template <typename ElementType, typename TypeOfCriticalSectionToUse, int minimumAllocatedSize>
1151template <class ElementComparator>
1152 void Array<ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize>::sort (
1153 [[maybe_unused]] ElementComparator& comparator,
1154 bool retainOrderOfEquivalentItems)
1155{
1156 const ScopedLockType lock (getLock());
1157 sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems);
1158}
1159
1160} // namespace juce
juce::ArrayBase
Definition juce_ArrayBase.h:41
juce::Array
Definition juce_Array.h:56
juce::Array::removeIf
int removeIf(PredicateType &&predicate)
Definition juce_Array.h:865
juce::Array::operator==
bool operator==(const OtherArrayType &other) const
Definition juce_Array.h:162
juce::Array::swapWith
void swapWith(OtherArrayType &otherArray) noexcept
Definition juce_Array.h:621
juce::Array::add
void add(ElementType &&newElement)
Definition juce_Array.h:428
juce::Array::setUnchecked
void setUnchecked(int indexToChange, ParameterType newValue)
Definition juce_Array.h:568
juce::Array::operator!=
bool operator!=(const OtherArrayType &other) const
Definition juce_Array.h:175
juce::Array::ScopedLockType
typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType
Definition juce_Array.h:1094
juce::Array::addNullTerminatedArray
void addNullTerminatedArray(const Type *const *elementsToAdd)
Definition juce_Array.h:605
juce::Array::getUnchecked
ElementType getUnchecked(int index) const
Definition juce_Array.h:252
juce::Array::insertArray
void insertArray(int indexToInsertAt, const ElementType *newElements, int numberOfElements)
Definition juce_Array.h:502
juce::Array::isEmpty
bool isEmpty() const noexcept
Definition juce_Array.h:222
juce::Array::removeLast
void removeLast(int howManyToRemove=1)
Definition juce_Array.h:914
juce::Array::Array
Array(const ElementType &firstNewElement, OtherElements &&... otherElements)
Definition juce_Array.h:113
juce::Array::ensureStorageAllocated
void ensureStorageAllocated(int minNumElements)
Definition juce_Array.h:1040
juce::Array::addArray
std::enable_if_t<! std::is_pointer_v< OtherArrayType >, void > addArray(const OtherArrayType &arrayToAddFrom, int startIndex, int numElementsToAdd=-1)
Definition juce_Array.h:653
juce::Array::remove
void remove(const ElementType *elementToRemove)
Definition juce_Array.h:784
juce::Array::getLock
const TypeOfCriticalSectionToUse & getLock() const noexcept
Definition juce_Array.h:1091
juce::Array::addArray
void addArray(const Type *elementsToAdd, int numElementsToAdd)
Definition juce_Array.h:583
juce::Array::Array
Array(const TypeToCreateFrom *data)
Definition juce_Array.h:83
juce::Array::clearQuick
void clearQuick()
Definition juce_Array.h:198
juce::Array::sort
void sort()
Definition juce_Array.h:1051
juce::Array::removeAllInstancesOf
int removeAllInstancesOf(ParameterType valueToRemove)
Definition juce_Array.h:836
juce::Array::Array
Array(const TypeToCreateFrom *data, int numValues)
Definition juce_Array.h:94
juce::Array::size
int size() const noexcept
Definition juce_Array.h:215
juce::Array::removeFirstMatchingValue
int removeFirstMatchingValue(ParameterType valueToRemove)
Definition juce_Array.h:810
juce::Array::fill
void fill(const ParameterType &newValue) noexcept
Definition juce_Array.h:205
juce::Array::removeRange
void removeRange(int startIndex, int numberToRemove)
Definition juce_Array.h:894
juce::Array::removeValuesIn
void removeValuesIn(const OtherArrayType &otherArray)
Definition juce_Array.h:936
juce::Array::end
const ElementType * end() const noexcept
Definition juce_Array.h:352
juce::Array::remove
void remove(int indexToRemove)
Definition juce_Array.h:742
juce::Array::insert
void insert(int indexToInsertAt, ParameterType newElement)
Definition juce_Array.h:462
juce::Array::indexOfSorted
int indexOfSorted(ElementComparator &comparator, TargetValueType elementToLookFor) const
Definition juce_Array.h:1124
juce::Array::getFirst
ElementType getFirst() const noexcept
Definition juce_Array.h:290
juce::Array::begin
ElementType * begin() noexcept
Definition juce_Array.h:328
juce::Array::end
ElementType * end() noexcept
Definition juce_Array.h:344
juce::Array::getRawDataPointer
ElementType * getRawDataPointer() noexcept
Definition juce_Array.h:310
juce::Array::Array
Array(ElementType &&singleElementToAdd)
Definition juce_Array.h:106
juce::Array::addUsingDefaultSort
void addUsingDefaultSort(ParameterType newElement)
Definition juce_Array.h:711
juce::Array::Array
Array()=default
juce::Array::indexOf
int indexOf(ParameterType elementToLookFor) const
Definition juce_Array.h:382
juce::Array::add
void add(const ElementType &newElement)
Definition juce_Array.h:418
juce::Array::Array
Array(ElementType &&firstNewElement, OtherElements &&... otherElements)
Definition juce_Array.h:120
juce::Array::removeAndReturn
ElementType removeAndReturn(int indexToRemove)
Definition juce_Array.h:760
juce::Array::operator[]
ElementType operator[](int index) const
Definition juce_Array.h:237
juce::Array::Array
Array(const ElementType &singleElementToAdd)
Definition juce_Array.h:100
juce::Array::set
void set(int indexToChange, ParameterType newValue)
Definition juce_Array.h:542
juce::Array::addSorted
int addSorted(ElementComparator &comparator, ParameterType newElement)
Definition juce_Array.h:694
juce::Array::contains
bool contains(ParameterType elementToLookFor) const
Definition juce_Array.h:400
juce::Array::insertMultiple
void insertMultiple(int indexToInsertAt, ParameterType newElement, int numberOfTimesToInsertIt)
Definition juce_Array.h:480
juce::Array::sort
void sort(ElementComparator &comparator, bool retainOrderOfEquivalentItems=false)
Definition juce_Array.h:1152
juce::Array::~Array
~Array()=default
juce::Array::add
void add(ElementType &&firstNewElement, OtherElements &&... otherElements)
Definition juce_Array.h:444
juce::Array::data
const ElementType * data() const noexcept
Definition juce_Array.h:368
juce::Array::resize
void resize(int targetNumItems)
Definition juce_Array.h:670
juce::Array::clear
void clear()
Definition juce_Array.h:188
juce::Array::move
void move(int currentIndex, int newIndex) noexcept
Definition juce_Array.h:1012
juce::Array::swap
void swap(int index1, int index2)
Definition juce_Array.h:992
juce::Array::data
ElementType * data() noexcept
Definition juce_Array.h:360
juce::Array::add
void add(const ElementType &firstNewElement, OtherElements &&... otherElements)
Definition juce_Array.h:436
juce::Array::removeValuesNotIn
void removeValuesNotIn(const OtherArrayType &otherArray)
Definition juce_Array.h:964
juce::Array::begin
const ElementType * begin() const noexcept
Definition juce_Array.h:336
juce::Array::getReference
const ElementType & getReference(int index) const noexcept
Definition juce_Array.h:281
juce::Array::addIfNotAlreadyThere
bool addIfNotAlreadyThere(ParameterType newElement)
Definition juce_Array.h:522
juce::Array::Array
Array(const Array &other)
Definition juce_Array.h:68
juce::Array::minimiseStorageOverheads
void minimiseStorageOverheads()
Definition juce_Array.h:1028
juce::Array::addArray
void addArray(const OtherArrayType &arrayToAddFrom)
Definition juce_Array.h:634
juce::Array::operator=
Array & operator=(const Array &other)
Definition juce_Array.h:137
juce::Array::getReference
ElementType & getReference(int index) noexcept
Definition juce_Array.h:267
juce::Array::getLast
ElementType getLast() const noexcept
Definition juce_Array.h:300
juce::Array::getRawDataPointer
const ElementType * getRawDataPointer() const noexcept
Definition juce_Array.h:319
juce::DefaultElementComparator
Definition juce_ElementComparator.h:185