diff --git a/include/openmc/search.h b/include/openmc/search.h index 81370a3de..c91ad18fe 100644 --- a/include/openmc/search.h +++ b/include/openmc/search.h @@ -14,6 +14,7 @@ template typename std::iterator_traits::difference_type lower_bound_index(It first, It last, const T& value) { + if (*first == value) return 0; It index = std::lower_bound(first, last, value) - 1; return (index == last) ? -1 : index - first; }