Browse Source

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

tags/2021-05-28
jules 13 years ago
parent
commit
dd7f4cbe40
2 changed files with 30 additions and 0 deletions
  1. +14
    -0
      modules/juce_core/containers/juce_SortedSet.h
  2. +16
    -0
      modules/juce_core/text/juce_StringArray.h

+ 14
- 0
modules/juce_core/containers/juce_SortedSet.h 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.


+ 16
- 0
modules/juce_core/text/juce_StringArray.h 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.


Loading…
Cancel
Save