]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix std::find for non-contiguous iterators [PR115799]
authorJonathan Wakely <jwakely@redhat.com>
Sat, 6 Jul 2024 20:34:29 +0000 (21:34 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Sun, 7 Jul 2024 11:26:09 +0000 (12:26 +0100)
commitce34fcc572a0dceebcffef76e98064546feebb38
tree602248de96c59ac425bc4b6027634bb66ef7e36c
parent762ee55d369a3257997092ef7853cf9dd4d5cc4f
libstdc++: Fix std::find for non-contiguous iterators [PR115799]

The r15-1857 change didn't correctly restrict the new optimization to
contiguous iterators.

libstdc++-v3/ChangeLog:

PR libstdc++/115799
* include/bits/stl_algo.h (find): Use 'if constexpr' so that
memchr optimization is a discarded statement for non-contiguous
iterators.
* testsuite/25_algorithms/find/bytes.cc: Check with input
iterators.
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/testsuite/25_algorithms/find/bytes.cc