This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

### 3707. `chunk_view::outer-iterator::value_type::size` should return unsigned type

Section: 26.7.27.4 [range.chunk.outer.value] Status: WP Submitter: Hewill Kang Opened: 2022-06-01 Last modified: 2022-07-25

Priority: Not Prioritized

View all issues with WP status.

Discussion:

Currently, the `size` function of `chunk_view::outer-iterator::value_type` returns the result of `ranges::min`, since the operands are of type `range_difference_t<V>`, this will return a signed type, which is inconsistent with the return type of `size` of the `forward`-version of `chunk_view::iterator::value_type` (26.7.27.7 [range.chunk.fwd.iter]), which always returns an unsigned type.

I think it's more reasonable to return an unsigned type, since this is intentional behavior and doesn't fall back to using the default `view_interface::size`. And if LWG 3646 is eventually adopted, there's no reason why it shouldn't be made unsigned.

[2022-06-21; Reflector poll]

Set status to Tentatively Ready after five votes in favour during reflector poll.

[2022-07-15; LWG telecon: move to Ready]

[2022-07-25 Approved at July 2022 virtual plenary. Status changed: Ready → WP.]

Proposed resolution:

This wording is relative to N4910.

1. Modify 26.7.27.4 [range.chunk.outer.value] as indicated:

   >     constexpr auto size() const
   >       requires sized_sentinel_for<sentinel_t<V>, iterator_t<V>>;

   > > -4- Effects: Equivalent to:

   > > >     return to-unsigned-like(ranges::min(parent_->remainder_, ranges::end(parent_->base_) - *parent_->current_));