Skip to content

Commit

Permalink
Inspect unwrapped iterators by _Prefer_iterator_copies (#4775)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGuteniev committed Jul 5, 2024
1 parent 9b63e8c commit d09326a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -10274,7 +10274,7 @@ namespace ranges {
auto _ULast = _RANGES _Uend(_Range);
_STL_ASSERT(
_UFirst != _ULast, "A range passed to std::ranges::minmax must not be empty. (N4971 [alg.min.max]/21)");
if constexpr (forward_range<_Rng> && _Prefer_iterator_copies<iterator_t<_Rng>>) {
if constexpr (forward_range<_Rng> && _Prefer_iterator_copies<decltype(_UFirst)>) {
return _Minmax_fwd_unchecked(
_STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj));
} else {
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -7005,7 +7005,7 @@ namespace ranges {
}
}
#endif // _USE_STD_VECTOR_ALGORITHMS
if constexpr (forward_range<_Rng> && _Prefer_iterator_copies<iterator_t<_Rng>>) {
if constexpr (forward_range<_Rng> && _Prefer_iterator_copies<decltype(_UFirst)>) {
return static_cast<range_value_t<_Rng>>(*_RANGES _Max_element_unchecked(
_STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)));
} else {
Expand Down Expand Up @@ -7223,7 +7223,7 @@ namespace ranges {
}
}
#endif // _USE_STD_VECTOR_ALGORITHMS
if constexpr (forward_range<_Rng> && _Prefer_iterator_copies<iterator_t<_Rng>>) {
if constexpr (forward_range<_Rng> && _Prefer_iterator_copies<decltype(_UFirst)>) {
return static_cast<range_value_t<_Rng>>(*_RANGES _Min_element_unchecked(
_STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)));
} else {
Expand Down

0 comments on commit d09326a

Please sign in to comment.