From 1a38beaaaf4cbdcc61a03e07a1212be17a5cd5c8 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 31 Jan 2023 16:37:12 -0800 Subject: Add const qualifier to c_binary_search Sequence. PiperOrigin-RevId: 506151912 Change-Id: I388884b0bd80ef0f8a0b3d3c7d0e1b404ddfb742 --- absl/algorithm/container.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'absl/algorithm') diff --git a/absl/algorithm/container.h b/absl/algorithm/container.h index c7782d4f..679e0267 100644 --- a/absl/algorithm/container.h +++ b/absl/algorithm/container.h @@ -1131,7 +1131,7 @@ c_equal_range(Sequence& sequence, const T& value, LessThan&& comp) { // to test if any element in the sorted container contains a value equivalent to // 'value'. template -bool c_binary_search(Sequence&& sequence, const T& value) { +bool c_binary_search(const Sequence& sequence, const T& value) { return std::binary_search(container_algorithm_internal::c_begin(sequence), container_algorithm_internal::c_end(sequence), value); @@ -1140,7 +1140,8 @@ bool c_binary_search(Sequence&& sequence, const T& value) { // Overload of c_binary_search() for performing a `comp` comparison other than // the default `operator<`. template -bool c_binary_search(Sequence&& sequence, const T& value, LessThan&& comp) { +bool c_binary_search(const Sequence& sequence, const T& value, + LessThan&& comp) { return std::binary_search(container_algorithm_internal::c_begin(sequence), container_algorithm_internal::c_end(sequence), value, std::forward(comp)); -- cgit v1.2.3