Title
cache_latest_view and to_input_view miss reserve_hint
Status
wp
Section
[range.cache.latest.view][range.to.input.view]
Submitter
Hewill Kang

Created on 2025-03-25.00:00:00 last changed 1 week ago

Messages

Date: 2025-06-23.16:37:24

Proposed resolution:

This wording is relative to N5008.

  1. Modify [range.cache.latest.view] as indicated:

    namespace std::ranges {
      template<input_range V>
        requires view<V>
      class cache_latest_view : public view_interface<cache_latest_view<V>> {
        […]
        constexpr auto size() requires sized_range<V>;
        constexpr auto size() const requires sized_range<const V>;
    
        constexpr auto reserve_hint() requires approximately_sized_range<V>;
        constexpr auto reserve_hint() const requires approximately_sized_range<const V>;
      };
      […]
    }
    
    […]
    constexpr auto size() requires sized_range<V>;
    constexpr auto size() const requires sized_range<const V>;
    

    -4- Effects: Equivalent to: return ranges::size(base_);

    
    constexpr auto reserve_hint() requires approximately_sized_range<V>;
    constexpr auto reserve_hint() const requires approximately_sized_range<const V>;
    

    -?- Effects: Equivalent to: return ranges::reserve_hint(base_);

  2. Modify [range.to.input.view] as indicated:

    template<input_range V>
      requires view<V>
    class to_input_view : public view_interface<to_input_view<V>> {
      […]
      constexpr auto size() requires sized_range<V>;
      constexpr auto size() const requires sized_range<const V>;
    
      constexpr auto reserve_hint() requires approximately_sized_range<V>;
      constexpr auto reserve_hint() const requires approximately_sized_range<const V>;
    };
    […]
    
    […]
    constexpr auto size() requires sized_range<V>;
    constexpr auto size() const requires sized_range<const V>;
    

    -5- Effects: Equivalent to: return ranges::size(base_);

    
    constexpr auto reserve_hint() requires approximately_sized_range<V>;
    constexpr auto reserve_hint() const requires approximately_sized_range<const V>;
    

    -?- Effects: Equivalent to: return ranges::reserve_hint(base_);

Date: 2025-06-23.16:37:24

[ Sofia 2025-06-21; Status changed: Voting → WP. ]

Date: 2025-06-15.00:00:00

[ 2025-06-13; Reflector poll ]

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

Date: 2025-06-15.00:00:00

[ 2025-06-12; Reflector poll ]

Set priority to 2 after reflector poll.

Date: 2025-03-25.00:00:00

Intuitively, both view classes should also have reserve_hint members.

History
Date User Action Args
2025-06-23 16:37:24adminsetmessages: + msg14860
2025-06-23 16:37:24adminsetstatus: voting -> wp
2025-06-13 09:03:14adminsetstatus: ready -> voting
2025-06-13 08:59:50adminsetmessages: + msg14809
2025-06-13 08:59:50adminsetstatus: new -> ready
2025-06-12 20:53:08adminsetmessages: + msg14791
2025-03-27 18:02:27adminsetmessages: + msg14708
2025-03-25 00:00:00admincreate