26JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4512)
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();
280 auto&
elem = data.getReference (s);
333 template <
class OtherSetType>
391 template <
class OtherSetType>
394 const typename OtherSetType::ScopedLockType
lock1 (
otherSet.getLock());
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());
430 for (
int i = data.size(); --i >= 0;)
431 if (!
otherSet.contains (data.getReference (i)))
442 template <
class OtherSetType>
457 data.minimiseStorageOverheads();
487JUCE_END_IGNORE_WARNINGS_MSVC
Holds a resizable array of primitive or copy-by-value objects.
Holds a set of unique primitive objects, such as ints or doubles.
int size() const noexcept
Returns the current number of elements in the set.
ElementType remove(const int indexToRemove) noexcept
Removes an element from the set.
bool isEmpty() const noexcept
Returns true if the set is empty, false otherwise.
int indexOf(const ElementType &elementToLookFor) const noexcept
Finds the index of the first element which matches the value passed in.
void addSet(const OtherSetType &setToAddFrom, int startIndex=0, int numElementsToAdd=-1) noexcept
Adds elements from another set to this one.
SortedSet()=default
Creates an empty set.
void addArray(const ElementType *elementsToAdd, int numElementsToAdd) noexcept
Adds elements from an array to this set.
const ElementType & getReference(const int index) const noexcept
Returns a direct reference to one of the elements in the set, without checking the index passed in.
ElementType getFirst() const noexcept
Returns the first element in the set, or 0 if the set is empty.
void removeValuesIn(const OtherSetType &otherSet) noexcept
Removes any elements which are also in another set.
bool add(const ElementType &newElement) noexcept
Adds a new element to the set, (as long as it's not already in there).
void clearQuick() noexcept
Removes all elements from the set without freeing the array's allocated storage.
ElementType getUnchecked(const int index) const noexcept
Returns one of the elements in the set, without checking the index passed in.
const TypeOfCriticalSectionToUse & getLock() const noexcept
Returns the CriticalSection that locks this array.
SortedSet(SortedSet &&) noexcept=default
Creates a copy of another set.
SortedSet(const SortedSet &)=default
Creates a copy of another set.
void swapWith(OtherSetType &otherSet) noexcept
This swaps the contents of this array with those of another array.
void minimiseStorageOverheads() noexcept
Reduces the amount of storage being used by the set.
ElementType getLast() const noexcept
Returns the last element in the set, or 0 if the set is empty.
void ensureStorageAllocated(const int minNumElements)
Increases the set's internal storage to hold a minimum number of elements.
ElementType & getReference(const int index) noexcept
Returns a direct reference to one of the elements in the set, without checking the index passed in.
const ElementType * end() const noexcept
Returns a pointer to the element which follows the last element in the set.
void removeValue(const ElementType &valueToRemove) noexcept
Removes an item from the set.
void clear() noexcept
Removes all elements from the set.
bool contains(const ElementType &elementToLookFor) const noexcept
Returns true if the set contains at least one occurrence of an object.
const ElementType * begin() const noexcept
Returns a pointer to the first element in the set.
void removeValuesNotIn(const OtherSetType &otherSet) noexcept
Removes any elements which are not found in another set.
typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType
Returns the type of scoped lock to use for locking this array.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...