Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<algorithm>: find_last is lacking _Could_compare_equal_to_value_type check #4553

Closed
AlexGuteniev opened this issue Apr 2, 2024 · 0 comments · Fixed by #4561
Closed

<algorithm>: find_last is lacking _Could_compare_equal_to_value_type check #4553

AlexGuteniev opened this issue Apr 2, 2024 · 0 comments · Fixed by #4561
Labels
bug Something isn't working fixed Something works now, yay!

Comments

@AlexGuteniev
Copy link
Contributor

Here it is missing

STL/stl/inc/algorithm

Lines 2974 to 2985 in be81252

if (!_STD is_constant_evaluated()) {
const auto _Count = _Last - _First;
const auto _First_ptr = _STD _To_address(_First);
const auto _Last_ptr = _First_ptr + _Count;
const auto _Result = _STD __std_find_last_trivial(_First_ptr, _Last_ptr, _Value);
if constexpr (is_pointer_v<_It>) {
return {_Result, _Last_ptr};
} else {
return {_First + (_Result - _First_ptr), _First + _Count};
}
}

Here it is present

STL/stl/inc/xutility

Lines 5919 to 5933 in be81252

if (!_STD is_constant_evaluated())
#endif // _HAS_CXX20
{
if (!_STD _Could_compare_equal_to_value_type<_InIt>(_Val)) {
return _Last;
}
#if _USE_STD_VECTOR_ALGORITHMS
const auto _First_ptr = _STD _To_address(_First);
const auto _Result = _STD __std_find_trivial(_First_ptr, _STD _To_address(_Last), _Val);
if constexpr (is_pointer_v<_InIt>) {
return _Result;
} else {
return _First + (_Result - _First_ptr);
}
#else // ^^^ _USE_STD_VECTOR_ALGORITHMS / !_USE_STD_VECTOR_ALGORITHMS vvv

@StephanTLavavej StephanTLavavej added the performance Must go faster label Apr 3, 2024
@StephanTLavavej StephanTLavavej added bug Something isn't working and removed performance Must go faster labels Apr 6, 2024
@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Something works now, yay!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants