summaryrefslogtreecommitdiff
path: root/klm/util/sorted_uniform.hh
diff options
context:
space:
mode:
authorWu, Ke <wuke@cs.umd.edu>2014-12-17 16:11:38 -0500
committerWu, Ke <wuke@cs.umd.edu>2014-12-17 16:11:38 -0500
commit7468e8d85e99b4619442c7afaf4a0d92870111bb (patch)
treea6f17da7c69048c8900260b5490bb9d8611be3bb /klm/util/sorted_uniform.hh
parentb6dd5a683db9dda2d634dd2fdb76606819594901 (diff)
parent1a79175f9a101d46cf27ca921213d5dd9300518f (diff)
Merge with upstream
Diffstat (limited to 'klm/util/sorted_uniform.hh')
-rw-r--r--klm/util/sorted_uniform.hh27
1 files changed, 3 insertions, 24 deletions
diff --git a/klm/util/sorted_uniform.hh b/klm/util/sorted_uniform.hh
index 7700d9e6..a3f6d021 100644
--- a/klm/util/sorted_uniform.hh
+++ b/klm/util/sorted_uniform.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_SORTED_UNIFORM__
-#define UTIL_SORTED_UNIFORM__
+#ifndef UTIL_SORTED_UNIFORM_H
+#define UTIL_SORTED_UNIFORM_H
#include <algorithm>
#include <cstddef>
@@ -101,27 +101,6 @@ template <class Iterator, class Accessor, class Pivot> bool SortedUniformFind(co
return BoundedSortedUniformFind<Iterator, Accessor, Pivot>(accessor, begin, below, end, above, key, out);
}
-// May return begin - 1.
-template <class Iterator, class Accessor> Iterator BinaryBelow(
- const Accessor &accessor,
- Iterator begin,
- Iterator end,
- const typename Accessor::Key key) {
- while (end > begin) {
- Iterator pivot(begin + (end - begin) / 2);
- typename Accessor::Key mid(accessor(pivot));
- if (mid < key) {
- begin = pivot + 1;
- } else if (mid > key) {
- end = pivot;
- } else {
- for (++pivot; (pivot < end) && accessor(pivot) == mid; ++pivot) {}
- return pivot - 1;
- }
- }
- return begin - 1;
-}
-
} // namespace util
-#endif // UTIL_SORTED_UNIFORM__
+#endif // UTIL_SORTED_UNIFORM_H