1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-05 03:50:07 +00:00

Added standard iterators to StringArray, and a SortedSet swap function.

This commit is contained in:
jules 2012-06-17 16:13:20 +01:00
parent 654134ffdb
commit dd7f4cbe40
2 changed files with 30 additions and 0 deletions

View file

@ -531,6 +531,20 @@ public:
}
}
/** This swaps the contents of this array with those of another array.
If you need to exchange two arrays, this is vastly quicker than using copy-by-value
because it just swaps their internal pointers.
*/
void swapWith (SortedSet& otherSet) noexcept
{
const ScopedLockType lock1 (getLock());
const ScopedLockType lock2 (otherSet.getLock());
data.swapWith (otherSet.data);
swapVariables (numUsed, otherSet.numUsed);
}
//==============================================================================
/** Reduces the amount of storage being used by the set.

View file

@ -125,6 +125,22 @@ public:
*/
String& getReference (int index) noexcept;
/** Returns a pointer to the first String in the array.
This method is provided for compatibility with standard C++ iteration mechanisms.
*/
inline String* begin() const noexcept
{
return strings.begin();
}
/** Returns a pointer to the String which follows the last element in the array.
This method is provided for compatibility with standard C++ iteration mechanisms.
*/
inline String* end() const noexcept
{
return strings.end();
}
/** Searches for a string in the array.
The comparison will be case-insensitive if the ignoreCase parameter is true.