34template <
typename ElementComparator>
39 template <
typename Type>
40 bool operator() (Type
a, Type
b) {
return comparator.compareElements (
a,
b) < 0; }
78template <
class ElementType,
class ElementComparator>
80 ElementType*
const array,
123template <
class ElementType,
class ElementComparator>
124static int findInsertIndexInSortedArray (ElementComparator& comparator,
125 ElementType*
const array,
126 const ElementType newElement,
130 jassert (firstElement <= lastElement);
132 ignoreUnused (comparator);
135 while (firstElement < lastElement)
137 if (comparator.compareElements (newElement, array [firstElement]) == 0)
144 const int halfway = (firstElement + lastElement) >> 1;
146 if (halfway == firstElement)
148 if (comparator.compareElements (newElement, array [halfway]) >= 0)
153 else if (comparator.compareElements (newElement, array [halfway]) >= 0)
155 firstElement = halfway;
159 lastElement = halfway;
184template <
class ElementType>
188 using ParameterType =
typename TypeHelpers::ParameterType<ElementType>::type;
191 static int compareElements (ParameterType first, ParameterType
second)
193 return (first <
second) ? -1 : ((
second < first) ? 1 : 0);