From d2c055d270958a834267b6e1535b8e4d476554d7 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 9 Dec 2022 15:00:01 -0300 Subject: [PATCH] Match binary_find. Thanks Gib. Former-commit-id: 9faedfc54782c5fbe4b63f1147182da3792a0b87 --- include/rstl/algorithm.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/rstl/algorithm.hpp b/include/rstl/algorithm.hpp index 0efc3bb9..86017aae 100644 --- a/include/rstl/algorithm.hpp +++ b/include/rstl/algorithm.hpp @@ -121,11 +121,7 @@ inline It binary_find(It start, It end, const T& value, Cmp cmp) { if (lower != end && !cmp(value, *lower)) { found = true; } - if (found) { - return lower; - } else { - return end; - } + return found ? lower : end; } template < typename T, typename Cmp >