mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Replaced some old juce-style sort operations with std::sort and lambdas
This commit is contained in:
parent
3659742a3a
commit
d4a7afa73f
17 changed files with 132 additions and 269 deletions
|
|
@ -41,8 +41,9 @@ struct FFT::Engine
|
|||
{
|
||||
Engine (int priorityToUse) : enginePriority (priorityToUse)
|
||||
{
|
||||
EnginePriorityComparator comparator;
|
||||
getEngines().addSorted (comparator, this);
|
||||
auto& list = getEngines();
|
||||
list.add (this);
|
||||
std::sort (list.begin(), list.end(), [] (Engine* a, Engine* b) { return b->enginePriority < a->enginePriority; });
|
||||
}
|
||||
|
||||
virtual ~Engine() {}
|
||||
|
|
@ -61,15 +62,6 @@ struct FFT::Engine
|
|||
}
|
||||
|
||||
private:
|
||||
struct EnginePriorityComparator
|
||||
{
|
||||
static int compareElements (Engine* first, Engine* second) noexcept
|
||||
{
|
||||
// sort in reverse order
|
||||
return DefaultElementComparator<int>::compareElements (second->enginePriority, first->enginePriority);
|
||||
}
|
||||
};
|
||||
|
||||
static Array<Engine*>& getEngines()
|
||||
{
|
||||
static Array<Engine*> engines;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue