31 #pragma warning (push)
32 #pragma warning (disable: 4512)
59template <
class ElementType,
class TypeOfCriticalSectionToUse = DummyCriticalSection>
334 template <
class OtherSetType>
392 template <
class OtherSetType>
404 for (
int i = data.
size(); --i >= 0;)
417 template <
class OtherSetType>
431 for (
int i = data.
size(); --i >= 0;)
443 template <
class OtherSetType>
489 #pragma warning (pop)
Holds a resizable array of primitive or copy-by-value objects.
void swapWith(OtherArrayType &otherArray) noexcept
This swaps the contents of this array with those of another array.
ElementType getUnchecked(int index) const
Returns one of the elements in the array, without checking the index passed in.
bool isEmpty() const noexcept
Returns true if the array is empty, false otherwise.
void ensureStorageAllocated(int minNumElements)
Increases the array's internal storage to hold a minimum number of elements.
const TypeOfCriticalSectionToUse & getLock() const noexcept
Returns the CriticalSection that locks this array.
void clearQuick()
Removes all elements from the array without freeing the array's allocated storage.
int size() const noexcept
Returns the current number of elements in the array.
ElementType * begin() const noexcept
Returns a pointer to the first element in the array.
void remove(int indexToRemove)
Removes an element from the array.
void insert(int indexToInsertAt, ParameterType newElement)
Inserts a new element into the array at a given position.
ElementType getFirst() const noexcept
Returns the first element in the array, or a default value if the array is empty.
ElementType removeAndReturn(int indexToRemove)
Removes an element from the array.
ElementType & getReference(int index) const noexcept
Returns a direct reference to one of the elements in the array, without checking the index passed in.
bool contains(ParameterType elementToLookFor) const
Returns true if the array contains at least one occurrence of an object.
void clear()
Removes all elements from the array.
ElementType * data() const noexcept
Returns a pointer to the first element in the array.
void minimiseStorageOverheads()
Reduces the amount of storage being used by the array.
ElementType getLast() const noexcept
Returns the last element in the array, or a default value if the array is empty.
ElementType * end() const noexcept
Returns a pointer to the element which follows the last element in the array.
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.
ElementType * begin() const noexcept
Returns a pointer to the first element in 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.
ElementType operator[](const int index) const noexcept
Returns one of the elements in the set.
void removeValue(const ElementType valueToRemove) noexcept
Removes an item from the set.
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.
ElementType getFirst() const noexcept
Returns the first element in the set, or 0 if the set is empty.
~SortedSet()=default
Destructor.
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).
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.
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.
SortedSet & operator=(const SortedSet &)=default
Makes a copy of another set.
const TypeOfCriticalSectionToUse & getLock() const noexcept
Returns the CriticalSection that locks this array.
SortedSet(const SortedSet &)=default
Creates a copy of another set.
bool operator!=(const SortedSet< ElementType > &other) const noexcept
Compares this set to another one.
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.
SortedSet(SortedSet &&other) noexcept
Creates a copy of another set.
bool operator==(const SortedSet< ElementType > &other) const noexcept
Compares this set to another one.
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.
ElementType * end() const noexcept
Returns a pointer to the element which follows the last 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.