mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Fix indexing below lower bound due to bin. search
This commit is contained in:
parent
08a8d3288f
commit
0792781dc5
1 changed files with 1 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ template<class It, class T>
|
|||
typename std::iterator_traits<It>::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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue