Skip to content

Commit

Permalink
Implement LWG-3707: chunk_view::outer-iterator::value_type::size sh…
Browse files Browse the repository at this point in the history
…ould return unsigned type (microsoft#2883)
  • Loading branch information
JMazurkiewicz authored and fsb4000 committed Aug 13, 2022
1 parent 200b2e5 commit 1382514
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -5380,7 +5380,8 @@ namespace ranges {
_NODISCARD constexpr auto size() const
noexcept(noexcept(_RANGES end(_Parent->_Range) - *_Parent->_Current)) /* strengthened */
requires sized_sentinel_for<sentinel_t<_Vw>, iterator_t<_Vw>> {
return (_STD min)(_Parent->_Remainder, _RANGES end(_Parent->_Range) - *_Parent->_Current);
return _To_unsigned_like(
(_STD min)(_Parent->_Remainder, _RANGES end(_Parent->_Range) - *_Parent->_Current));
}
};

Expand Down
3 changes: 2 additions & 1 deletion tests/std/tests/P2442R1_views_chunk/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ constexpr bool test_input(Rng&& rng, Expected&& expected) {

auto val_ty = *outer_iter;
if constexpr (sized_sentinel_for<sentinel_t<Rng>, iterator_t<Rng>>) {
assert(val_ty.size() == 2);
const same_as<_Make_unsigned_like_t<ranges::range_difference_t<V>>> auto s = val_ty.size(); // test LWG-3707
assert(s == 2);
}

auto inner_iter = val_ty.begin();
Expand Down

0 comments on commit 1382514

Please sign in to comment.