34template <
typename ElementComparator>
40 template <
typename Type>
41 bool operator() (Type
a, Type
b) {
return comparator.compareElements (
a,
b) < 0; }
80template <
class ElementType,
class ElementComparator>
81static void sortArray (ElementComparator& comparator,
82 ElementType*
const array,
85 const bool retainOrderOfEquivalentItems)
89 if (lastElement > firstElement)
93 if (retainOrderOfEquivalentItems)
94 std::stable_sort (array + firstElement, array + lastElement + 1, converter);
96 std::sort (array + firstElement, array + lastElement + 1, converter);
125template <
class ElementType,
class ElementComparator>
127 ElementType*
const array,
128 const ElementType newElement,
132 jassert (firstElement <= lastElement);
137 while (firstElement < lastElement)
139 if (comparator.compareElements (newElement, array [firstElement]) == 0)
146 const int halfway = (firstElement + lastElement) >> 1;
148 if (halfway == firstElement)
150 if (comparator.compareElements (newElement, array [halfway]) >= 0)
155 else if (comparator.compareElements (newElement, array [halfway]) >= 0)
157 firstElement = halfway;
161 lastElement = halfway;
186template <
class ElementType>
195 return (first < second) ? -1 : ((second < first) ? 1 : 0);
uint8_t a
Definition Spc_Cpu.h:141
Definition juce_ElementComparator.h:188
typename TypeHelpers::ParameterType< ElementType >::type ParameterType
Definition juce_ElementComparator.h:190
static int compareElements(ParameterType first, ParameterType second)
Definition juce_ElementComparator.h:193
* e
Definition inflate.c:1404
Definition carla_juce.cpp:31
static int findInsertIndexInSortedArray(ElementComparator &comparator, ElementType *const array, const ElementType newElement, int firstElement, int lastElement)
Definition juce_ElementComparator.h:126
static void sortArray(ElementComparator &comparator, ElementType *const array, int firstElement, int lastElement, const bool retainOrderOfEquivalentItems)
Definition juce_ElementComparator.h:81
void ignoreUnused(Types &&...) noexcept
Definition juce_MathsFunctions.h:333
Definition juce_ElementComparator.h:36
SortFunctionConverter(ElementComparator &e)
Definition juce_ElementComparator.h:37
ElementComparator & comparator
Definition juce_ElementComparator.h:44
SortFunctionConverter(const SortFunctionConverter &)=default
const Type & type
Definition juce_MathsFunctions.h:632