29 #ifndef JUCE_SORTEDSET_H_INCLUDED
30 #define JUCE_SORTEDSET_H_INCLUDED
33 #pragma warning (push)
34 #pragma warning (disable: 4512)
59 template <
class ElementType,
class TypeOfCriticalSectionToUse = DummyCriticalSection>
98 return data == other.data;
238 const int halfway = (s + e) / 2;
257 return indexOf (elementToLookFor) >= 0;
282 if (newElement == elem)
288 const int halfway = (s + e) / 2;
289 const bool isBeforeHalfway = (newElement < data.
getReference (halfway));
293 if (! isBeforeHalfway)
305 data.
insert (s, newElement);
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());
342 jassert (
this != &setToAddFrom);
344 if (
this != &setToAddFrom)
352 if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
353 numElementsToAdd = setToAddFrom.size() - startIndex;
355 if (numElementsToAdd > 0)
356 addArray (&setToAddFrom.data.getReference (startIndex), numElementsToAdd);
371 ElementType
remove (
const int indexToRemove)
noexcept
373 return data.
remove (indexToRemove);
394 template <
class OtherSetType>
397 const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
400 if (
this == &otherSet)
404 else if (otherSet.size() > 0)
406 for (
int i = data.
size(); --i >= 0;)
419 template <
class OtherSetType>
422 const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
425 if (
this != &otherSet)
427 if (otherSet.size() <= 0)
433 for (
int i = data.
size(); --i >= 0;)
445 template <
class OtherSetType>
491 #pragma warning (pop)
494 #endif // JUCE_SORTEDSET_H_INCLUDED
ElementType * begin() const noexcept
Definition: juce_core.h:329
ElementType getLast() const noexcept
Definition: juce_SortedSet.h:192
int size() const noexcept
Definition: juce_SortedSet.h:134
void minimiseStorageOverheads()
Definition: juce_core.h:1033
void swapWith(OtherArrayType &otherArray) noexcept
Definition: juce_core.h:651
#define noexcept
Definition: juce_CompilerSupport.h:141
SortedSet & operator=(const SortedSet &other) noexcept
Definition: juce_SortedSet.h:85
void clearQuick()
Definition: juce_core.h:212
void minimiseStorageOverheads() noexcept
Definition: juce_SortedSet.h:458
ElementType & getReference(const int index) const noexcept
Definition: juce_core.h:275
ElementType getLast() const
Definition: juce_core.h:303
void ensureStorageAllocated(const int minNumElements)
Definition: juce_SortedSet.h:469
Definition: juce_SortedSet.h:60
bool operator==(const SortedSet< ElementType > &other) const noexcept
Definition: juce_SortedSet.h:96
void removeValue(const ElementType valueToRemove) noexcept
Definition: juce_SortedSet.h:383
~SortedSet() noexcept
Definition: juce_SortedSet.h:78
TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType
Definition: juce_SortedSet.h:482
void insert(int indexToInsertAt, ParameterType newElement)
Definition: juce_core.h:426
void clearQuick() noexcept
Definition: juce_SortedSet.h:127
void removeValuesNotIn(const OtherSetType &otherSet) noexcept
Definition: juce_SortedSet.h:420
ElementType operator[](const int index) const noexcept
Definition: juce_SortedSet.h:150
bool operator!=(const SortedSet< ElementType > &other) const noexcept
Definition: juce_SortedSet.h:105
bool add(const ElementType &newElement) noexcept
Definition: juce_SortedSet.h:272
void addSet(const OtherSetType &setToAddFrom, int startIndex=0, int numElementsToAdd=-1) noexcept
Definition: juce_SortedSet.h:334
ElementType * end() const noexcept
Definition: juce_core.h:337
void swapWith(OtherSetType &otherSet) noexcept
Definition: juce_SortedSet.h:446
int indexOf(const ElementType &elementToLookFor) const noexcept
Definition: juce_SortedSet.h:223
ElementType getUnchecked(const int index) const
Definition: juce_core.h:259
void clear() noexcept
Definition: juce_SortedSet.h:119
void ensureStorageAllocated(const int minNumElements)
Definition: juce_core.h:1045
Definition: juce_CriticalSection.h:148
const TypeOfCriticalSectionToUse & getLock() const noexcept
Definition: juce_SortedSet.h:479
void clear()
Definition: juce_core.h:201
int size() const noexcept
Definition: juce_core.h:222
Definition: juce_Array.h:60
const TypeOfCriticalSectionToUse & getLock() const noexcept
Definition: juce_core.h:1093
ElementType * begin() const noexcept
Definition: juce_SortedSet.h:201
bool contains(const ElementType &elementToLookFor) const noexcept
Definition: juce_SortedSet.h:255
void removeValuesIn(const OtherSetType &otherSet) noexcept
Definition: juce_SortedSet.h:395
ElementType & getReference(const int index) const noexcept
Definition: juce_SortedSet.h:176
ElementType remove(const int indexToRemove)
Definition: juce_core.h:796
ElementType getFirst() const
Definition: juce_core.h:286
ElementType getFirst() const noexcept
Definition: juce_SortedSet.h:184
SortedSet(const SortedSet &other)
Definition: juce_SortedSet.h:72
void addArray(const ElementType *elementsToAdd, int numElementsToAdd) noexcept
Definition: juce_SortedSet.h:315
ElementType getUnchecked(const int index) const noexcept
Definition: juce_SortedSet.h:163
ElementType * end() const noexcept
Definition: juce_SortedSet.h:209
SortedSet() noexcept
Definition: juce_SortedSet.h:65