diff options
author | Abseil Team <absl-team@google.com> | 2023-01-31 16:37:12 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-01-31 16:37:53 -0800 |
commit | 1a38beaaaf4cbdcc61a03e07a1212be17a5cd5c8 (patch) | |
tree | 066e7fdbc3e2fea6812a66dc45b2e7ec12656b20 | |
parent | dcddc54407e44b55815e9aa784c84f5c933ca310 (diff) |
Add const qualifier to c_binary_search Sequence.
PiperOrigin-RevId: 506151912
Change-Id: I388884b0bd80ef0f8a0b3d3c7d0e1b404ddfb742
-rw-r--r-- | absl/algorithm/container.h | 5 |
1 files changed, 3 insertions, 2 deletions
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 <typename Sequence, typename T> -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 <typename Sequence, typename T, typename LessThan> -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<LessThan>(comp)); |