Title
The end of chunk_view for input ranges can be const
Status
wp
Section
[range.chunk.view.input]
Submitter
Hewill Kang

Created on 2022-06-09.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.view.input] as indicated:

    namespace std::ranges {
      […]
     
      template<view V>
        requires input_range<V>
      class chunk_view : public view_interface<chunk_view<V>> {
        V base_ = V();                                        // exposition only
        […]
      public:
        […]
    
        constexpr outer-iterator begin();
        constexpr default_sentinel_t end() const noexcept;
    
        constexpr auto size() requires sized_range<V>;
        constexpr auto size() const requires sized_range<const V>;
      };
      […]
    }
    
    […]
    constexpr default_sentinel_t end() const noexcept;
    

    -4- Returns: default_sentinel.

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 eight votes in favour during reflector poll.

Date: 2022-06-09.00:00:00

The input range version of chunk_view's end is a very simple function that only returns default_sentinel, and simple ends like this also appear in other range adaptors, such as basic_istream_view, lazy_split_view::outer-iterator::value_type, and chunk_view::outer-iterator::value_type.

However, unlike chunk_view, their ends all are const-qualified, which allows us to freely get default_sentinel through the end of these const objects even though they may not themselves be ranges.

I think we should add const to this chunk_view's end as I don't see any harm in doing this, and in some cases, it may have a certain value. Also, this makes it consistent with basic_istream_view and the upcoming std::generator, which, like it, only has a non-const begin.

History
Date User Action Args
2022-07-25 20:32:58adminsetmessages: + msg12651
2022-07-25 20:32:58adminsetstatus: ready -> wp
2022-07-25 20:28:19adminsetmessages: + msg12625
2022-06-21 11:47:28adminsetmessages: + msg12521
2022-06-21 11:47:28adminsetstatus: new -> ready
2022-06-11 14:54:07adminsetmessages: + msg12491
2022-06-09 00:00:00admincreate