25 #ifndef COMMON_BINSEARCH_H 26 #define COMMON_BINSEARCH_H 33 template<
typename TK,
typename TV>
40 template<
typename TK,
typename TV>
42 size_t low = 0, high = size - 1, midpoint = 0;
44 while ((low <= high) && (high < size) && (low < size)) {
45 midpoint = low + ((high - low) / 2);
47 if (value == map[midpoint].key)
48 return &map[midpoint];
49 else if (value < map[midpoint].key)
60 #endif // COMMON_BINSEARCH_H
const BinSearchValue< TK, TV > * binarySearch(const BinSearchValue< TK, TV > *map, size_t size, const TK &value)
Search through this sorted list of key/value pairs.
Struct template for a generic searchable key/value pair.