mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added a new method Array::sort() which uses the default comparator for simple types
This commit is contained in:
parent
663eca60ad
commit
4fd8913037
2 changed files with 12 additions and 4 deletions
|
|
@ -941,9 +941,7 @@ private:
|
|||
}
|
||||
|
||||
bufferSizes.addIfNotAlreadyThere (preferredSize);
|
||||
|
||||
DefaultElementComparator <int> comparator;
|
||||
bufferSizes.sort (comparator);
|
||||
bufferSizes.sort();
|
||||
}
|
||||
|
||||
double getSampleRate() const
|
||||
|
|
|
|||
|
|
@ -1053,6 +1053,16 @@ public:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Sorts the array using a default comparison operation.
|
||||
If the type of your elements isn't supported by the DefaultElementComparator class
|
||||
then you may need to use the other version of sort, which takes a custom comparator.
|
||||
*/
|
||||
void sort()
|
||||
{
|
||||
DefaultElementComparator<ElementType> comparator;
|
||||
sort (comparator);
|
||||
}
|
||||
|
||||
/** Sorts the elements in the array.
|
||||
|
||||
This will use a comparator object to sort the elements into order. The object
|
||||
|
|
@ -1081,7 +1091,7 @@ public:
|
|||
*/
|
||||
template <class ElementComparator>
|
||||
void sort (ElementComparator& comparator,
|
||||
const bool retainOrderOfEquivalentItems = false) const
|
||||
const bool retainOrderOfEquivalentItems = false)
|
||||
{
|
||||
const ScopedLockType lock (getLock());
|
||||
(void) comparator; // if you pass in an object with a static compareElements() method, this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue