Skip to content

Commit

Permalink
Check if find_last can find anything (#4561)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
  • Loading branch information
AlexGuteniev and StephanTLavavej committed Apr 9, 2024
1 parent 51b1a07 commit d0995ff
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 4 deletions.
7 changes: 6 additions & 1 deletion stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -3028,7 +3028,12 @@ namespace ranges {
if constexpr (is_same_v<_Pj, identity> && _Vector_alg_in_find_is_safe<_It, _Ty>
&& sized_sentinel_for<_Se, _It>) {
if (!_STD is_constant_evaluated()) {
const auto _Count = _Last - _First;
const auto _Count = _Last - _First;

if (!_STD _Could_compare_equal_to_value_type<_It>(_Value)) {
return {_First + _Count, _First + _Count};
}

const auto _First_ptr = _STD _To_address(_First);
const auto _Last_ptr = _First_ptr + _Count;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_matrix.lst
RUNALL_CROSSLIST
* PM_CL=""
* PM_CL="/D_USE_STD_VECTOR_ALGORITHMS=0"
Loading

0 comments on commit d0995ff

Please sign in to comment.