Currently swapWithArray only works with other arrays that have the same template arguments. Specifically, the type of critical section to use. I think it should look like this:
template <class OtherArrayType>
void swapWithArray (OtherArrayType& otherArray) noexcept
{
const ScopedLockType lock1 (getLock());
const typename OtherArrayType::ScopedLockType lock2 (otherArray.getLock());
data.swapWith (otherArray.data);
std::swap (numUsed, otherArray.numUsed);
}
If you make this change please do it in all the containers that have the function!
Also its possible that the same idea applies to any other functions which take some other container as a parameter, as I believe all JUCE containers have a critical section template argument.
Things get a little tricky with SortedSet::swapWith but I’m sure your genius mind can sort that out Jules!
If you would rename Array::swapWithArray to Array::swapWith and make this consistent across all containers that would be great too, but I’m not expecting miracles.