Commit 1a38beaa by Abseil Team Committed by Copybara-Service

Add const qualifier to c_binary_search Sequence.

PiperOrigin-RevId: 506151912
Change-Id: I388884b0bd80ef0f8a0b3d3c7d0e1b404ddfb742
parent dcddc544
...@@ -1131,7 +1131,7 @@ c_equal_range(Sequence& sequence, const T& value, LessThan&& comp) { ...@@ -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 // to test if any element in the sorted container contains a value equivalent to
// 'value'. // 'value'.
template <typename Sequence, typename T> 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), return std::binary_search(container_algorithm_internal::c_begin(sequence),
container_algorithm_internal::c_end(sequence), container_algorithm_internal::c_end(sequence),
value); value);
...@@ -1140,7 +1140,8 @@ bool c_binary_search(Sequence&& sequence, const T& 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 // Overload of c_binary_search() for performing a `comp` comparison other than
// the default `operator<`. // the default `operator<`.
template <typename Sequence, typename T, typename LessThan> 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), return std::binary_search(container_algorithm_internal::c_begin(sequence),
container_algorithm_internal::c_end(sequence), container_algorithm_internal::c_end(sequence),
value, std::forward<LessThan>(comp)); value, std::forward<LessThan>(comp));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment