Skip to content

<algorithm>: find_last is lacking _Could_compare_equal_to_value_type check #4553

@AlexGuteniev

Description

@AlexGuteniev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions