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>
82 ElementType*
const array,
125template <
class ElementType,
class ElementComparator>
126static int findInsertIndexInSortedArray ([[maybe_unused]] ElementComparator& comparator,
127 ElementType*
const array,
128 const ElementType newElement,
132 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;
183template <
class ElementType>
187 using ParameterType =
typename TypeHelpers::ParameterType<ElementType>::type;
190 static int compareElements (ParameterType first, ParameterType
second)
192 return (first <
second) ? -1 : ((
second < first) ? 1 : 0);