1 #ifndef __libquark_util_Algorithms_hxx 2 #define __libquark_util_Algorithms_hxx 28 template<
typename ITER,
typename T,
typename LESSTHAN>
30 LESSTHAN lessThan = defaultLessThan)
32 if(begin == end)
return 0;
40 int half = (right - left) >> 1;
41 ITER mid = left + half;
43 if(lessThan(*mid, item))
49 else if(lessThan(item, *mid))
58 if(lessThan(*offset, item))
61 return(offset - begin);
66 template<
typename T>
static bool defaultLessThan(
const T &a,
const T &b)
77 #endif // __libquark_util_Algorithms_hxx Definition: BarChartView.h++:6
A collection of general-purpose algorithms.
Definition: Algorithms.h++:10
static int orderedInsertPosition(ITER begin, ITER end, const T &item, LESSTHAN lessThan=defaultLessThan)
Returns the insert position for an item in a (presumably sorted) collection.
Definition: Algorithms.h++:29