mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 06:44:38 +01:00
21 lines
766 B
C++
21 lines
766 B
C++
/*****************************************************************************
|
|
* Copyright (c) 2014-2024 OpenRCT2 developers
|
|
*
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
|
*
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
|
*****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#include <algorithm>
|
|
#include <functional>
|
|
|
|
template<class ForwardIt, class T, class Compare = std::less<>>
|
|
ForwardIt BinaryFind(ForwardIt first, ForwardIt last, const T& value, Compare comp = {})
|
|
{
|
|
first = std::lower_bound(first, last, value, comp);
|
|
return first != last && !comp(value, *first) ? first : last;
|
|
}
|