52template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
82 return data == other.data;
91 return ! operator== (other);
140 inline ElementType operator[] (
const int index)
const noexcept
155 return data.getUnchecked (index);
168 return data.getReference (index);
175 inline const ElementType&
getReference (
const int index)
const noexcept
177 return data.getReference (index);
185 return data.getFirst();
193 return data.getLast();
222 int indexOf (
const ElementType& elementToLookFor)
const noexcept
234 if (elementToLookFor ==
data.getReference (
s))
237 auto halfway = (
s +
e) / 2;
242 if (elementToLookFor <
data.getReference (halfway))
254 bool contains (
const ElementType& elementToLookFor)
const noexcept
256 return indexOf (elementToLookFor) >= 0;
271 bool add (
const ElementType& newElement)
noexcept
280 auto& elem =
data.getReference (
s);
282 if (newElement == elem)
288 auto halfway = (
s +
e) / 2;
289 bool isBeforeHalfway = (newElement <
data.getReference (halfway));
293 if (! isBeforeHalfway)
305 data.insert (
s, newElement);
316 int numElementsToAdd)
noexcept
320 while (--numElementsToAdd >= 0)
321 add (*elementsToAdd++);
333 template <
class OtherSetType>
334 void addSet (
const OtherSetType& setToAddFrom,
338 const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
340 jassert (
this != &setToAddFrom);
342 if (
this != &setToAddFrom)
350 if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
351 numElementsToAdd = setToAddFrom.size() - startIndex;
353 if (numElementsToAdd > 0)
354 addArray (&setToAddFrom.data.getReference (startIndex), numElementsToAdd);
368 ElementType
remove (
const int indexToRemove)
noexcept
370 return data.removeAndReturn (indexToRemove);
391 template <
class OtherSetType>
394 const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
397 if (
this == &otherSet)
401 else if (! otherSet.isEmpty())
403 for (
int i =
data.size(); --
i >= 0;)
404 if (otherSet.contains (
data.getReference (
i)))
416 template <
class OtherSetType>
419 const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
422 if (
this != &otherSet)
424 if (otherSet.isEmpty())
430 for (
int i =
data.size(); --
i >= 0;)
431 if (! otherSet.contains (
data.getReference (
i)))
442 template <
class OtherSetType>
445 data.swapWith (otherSet.data);
457 data.minimiseStorageOverheads();
468 data.ensureStorageAllocated (minNumElements);
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_Array.h:56
int size() const noexcept
Definition juce_SortedSet.h:118
ElementType remove(const int indexToRemove) noexcept
Definition juce_SortedSet.h:368
bool isEmpty() const noexcept
Definition juce_SortedSet.h:124
int indexOf(const ElementType &elementToLookFor) const noexcept
Definition juce_SortedSet.h:222
void addSet(const OtherSetType &setToAddFrom, int startIndex=0, int numElementsToAdd=-1) noexcept
Definition juce_SortedSet.h:334
void addArray(const ElementType *elementsToAdd, int numElementsToAdd) noexcept
Definition juce_SortedSet.h:315
const ElementType & getReference(const int index) const noexcept
Definition juce_SortedSet.h:175
ElementType getFirst() const noexcept
Definition juce_SortedSet.h:183
void removeValuesIn(const OtherSetType &otherSet) noexcept
Definition juce_SortedSet.h:392
bool add(const ElementType &newElement) noexcept
Definition juce_SortedSet.h:271
void clearQuick() noexcept
Definition juce_SortedSet.h:111
ElementType getUnchecked(const int index) const noexcept
Definition juce_SortedSet.h:153
const TypeOfCriticalSectionToUse & getLock() const noexcept
Definition juce_SortedSet.h:476
SortedSet(SortedSet &&) noexcept=default
SortedSet(const SortedSet &)=default
Array< ElementType, TypeOfCriticalSectionToUse > data
Definition juce_SortedSet.h:484
void swapWith(OtherSetType &otherSet) noexcept
Definition juce_SortedSet.h:443
void minimiseStorageOverheads() noexcept
Definition juce_SortedSet.h:455
ElementType getLast() const noexcept
Definition juce_SortedSet.h:191
void ensureStorageAllocated(const int minNumElements)
Definition juce_SortedSet.h:466
ElementType & getReference(const int index) noexcept
Definition juce_SortedSet.h:166
const ElementType * end() const noexcept
Definition juce_SortedSet.h:208
void removeValue(const ElementType &valueToRemove) noexcept
Definition juce_SortedSet.h:380
void clear() noexcept
Definition juce_SortedSet.h:103
bool contains(const ElementType &elementToLookFor) const noexcept
Definition juce_SortedSet.h:254
const ElementType * begin() const noexcept
Definition juce_SortedSet.h:200
void removeValuesNotIn(const OtherSetType &otherSet) noexcept
Definition juce_SortedSet.h:417
typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType
Definition juce_SortedSet.h:479
* e
Definition inflate.c:1404
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
#define JUCE_BEGIN_IGNORE_WARNINGS_MSVC(warnings)
Definition juce_CompilerWarnings.h:198
#define JUCE_END_IGNORE_WARNINGS_MSVC
Definition juce_CompilerWarnings.h:199
Definition carla_juce.cpp:31
#define const
Definition zconf.h:137