|
|
|
@@ -85,7 +85,7 @@ public: |
|
|
|
|
|
|
|
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
|
|
|
|
Array (Array<ElementType, TypeOfCriticalSectionToUse>&& other) noexcept
|
|
|
|
: data (static_cast <ArrayAllocationBase<ElementType, TypeOfCriticalSectionToUse>&&> (other.data)),
|
|
|
|
: data (static_cast<ArrayAllocationBase<ElementType, TypeOfCriticalSectionToUse>&&> (other.data)),
|
|
|
|
numUsed (other.numUsed)
|
|
|
|
{
|
|
|
|
other.numUsed = 0;
|
|
|
|
@@ -143,7 +143,7 @@ public: |
|
|
|
Array& operator= (Array&& other) noexcept
|
|
|
|
{
|
|
|
|
const ScopedLockType lock (getLock());
|
|
|
|
data = static_cast <ArrayAllocationBase<ElementType, TypeOfCriticalSectionToUse>&&> (other.data);
|
|
|
|
data = static_cast<ArrayAllocationBase<ElementType, TypeOfCriticalSectionToUse>&&> (other.data);
|
|
|
|
numUsed = other.numUsed;
|
|
|
|
other.numUsed = 0;
|
|
|
|
return *this;
|
|
|
|
@@ -369,13 +369,27 @@ public: |
|
|
|
@param newElement the new object to add to the array
|
|
|
|
@see set, insert, addIfNotAlreadyThere, addSorted, addUsingDefaultSort, addArray
|
|
|
|
*/
|
|
|
|
void add (ParameterType newElement)
|
|
|
|
void add (const ElementType& newElement)
|
|
|
|
{
|
|
|
|
const ScopedLockType lock (getLock());
|
|
|
|
data.ensureAllocatedSize (numUsed + 1);
|
|
|
|
new (data.elements + numUsed++) ElementType (newElement);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
|
|
|
|
/** Appends a new element at the end of the array.
|
|
|
|
|
|
|
|
@param newElement the new object to add to the array
|
|
|
|
@see set, insert, addIfNotAlreadyThere, addSorted, addUsingDefaultSort, addArray
|
|
|
|
*/
|
|
|
|
void add (ElementType&& newElement)
|
|
|
|
{
|
|
|
|
const ScopedLockType lock (getLock());
|
|
|
|
data.ensureAllocatedSize (numUsed + 1);
|
|
|
|
new (data.elements + numUsed++) ElementType (static_cast<ElementType&&> (newElement));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Inserts a new element into the array at a given position.
|
|
|
|
|
|
|
|
If the index is less than 0 or greater than the size of the array, the
|
|
|
|
|