Skip to content

Commit bdcd8ea

Browse files
authored
Simplify the comparison of sizes of different ranges (#4864)
1 parent dc1b46c commit bdcd8ea

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

stl/inc/algorithm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,10 +933,8 @@ namespace ranges {
933933
_NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(
934934
_Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR {
935935
if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) {
936-
using _Size1 = _Make_unsigned_like_t<range_size_t<_Rng1>>;
937-
const auto _Count = static_cast<_Size1>(_RANGES size(_Range1));
938-
using _Size2 = _Make_unsigned_like_t<range_size_t<_Rng2>>;
939-
if (_Count != static_cast<_Size2>(_RANGES size(_Range2))) {
936+
const auto _Count = _RANGES distance(_Range1);
937+
if (_Count != _RANGES distance(_Range2)) {
940938
return false;
941939
}
942940
return _RANGES _Equal_count(_Ubegin(_Range1), _Ubegin(_Range2), _Count, _STD _Pass_fn(_Pred),

0 commit comments

Comments
 (0)