29 #ifndef JUCE_ELEMENTCOMPARATOR_H_INCLUDED 30 #define JUCE_ELEMENTCOMPARATOR_H_INCLUDED 38 template <
typename ElementComparator>
43 template <
typename Type>
44 bool operator() (Type a, Type
b) {
return comparator.compareElements (a, b) < 0; }
47 ElementComparator& comparator;
82 template <
class ElementType,
class ElementComparator>
83 static void sortArray (ElementComparator& comparator,
84 ElementType*
const array,
87 const bool retainOrderOfEquivalentItems)
91 if (retainOrderOfEquivalentItems)
92 std::stable_sort (array + firstElement, array + lastElement + 1, converter);
94 std::sort (array + firstElement, array + lastElement + 1, converter);
122 template <
class ElementType,
class ElementComparator>
123 static int findInsertIndexInSortedArray (ElementComparator& comparator,
124 ElementType*
const array,
125 const ElementType newElement,
129 jassert (firstElement <= lastElement);
134 while (firstElement < lastElement)
136 if (comparator.compareElements (newElement, array [firstElement]) == 0)
143 const int halfway = (firstElement + lastElement) >> 1;
145 if (halfway == firstElement)
147 if (comparator.compareElements (newElement, array [halfway]) >= 0)
152 else if (comparator.compareElements (newElement, array [halfway]) >= 0)
154 firstElement = halfway;
158 lastElement = halfway;
181 template <
class ElementType>
190 return (first < second) ? -1 : ((second < first) ? 1 : 0);
195 #endif // JUCE_ELEMENTCOMPARATOR_H_INCLUDED static int compareElements(ParameterType first, ParameterType second)
Definition: juce_ElementComparator.h:188
long b
Definition: jpegint.h:371
bool operator()(Type a, Type b)
Definition: juce_ElementComparator.h:44
#define JUCE_DELETED_FUNCTION
Definition: juce_CompilerSupport.h:133
Definition: juce_ElementComparator.h:39
void
Definition: juce_PNGLoader.cpp:1173
#define PARAMETER_TYPE(a)
Definition: juce_ElementComparator.h:182
SortFunctionConverter(ElementComparator &e)
Definition: juce_ElementComparator.h:41