Title
chunk_view::outer-iterator::value_type::size should return unsigned type
Status
wp
Section
[range.chunk.outer.value]
Submitter
Hewill Kang

Created on 2022-06-01.00:00:00 last changed 4 months ago

Messages

Date: 2022-07-25.20:32:58

Proposed resolution:

This wording is relative to N4910.

  1. Modify [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_));
    
Date: 2022-07-25.00:00:00

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

Date: 2022-07-15.00:00:00

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

Date: 2022-06-15.00:00:00

[ 2022-06-21; Reflector poll ]

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

Date: 2022-06-01.00:00:00

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 ([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.

History
Date User Action Args
2022-07-25 20:32:58adminsetmessages: + msg12648
2022-07-25 20:32:58adminsetstatus: ready -> wp
2022-07-25 20:28:19adminsetmessages: + msg12622
2022-06-21 11:47:28adminsetmessages: + msg12518
2022-06-21 11:47:28adminsetstatus: new -> ready
2022-06-05 07:14:48adminsetmessages: + msg12485
2022-06-01 00:00:00admincreate