/* binaryfind.h Copyright (C) 2009 yellow wood goblin SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once #include namespace akui { template Iterator binary_find(Iterator first, Iterator last, const T& value, Compare cmp) { Iterator result = std::lower_bound(first, last, value, cmp); if (result == last) return last; else if (!cmp(value, *result)) return result; else return last; } } // namespace akui