Title
Unexpected constraints on adjacent_transform_view::base()
Status
wp
Section
[range.adjacent.transform.view]
Submitter
Bo Persson

Created on 2023-06-17.00:00:00 last changed 13 months ago

Messages

Date: 2023-11-13.14:08:10

Proposed resolution:

This wording is relative to N4950.

  1. Modify [range.adjacent.transform.view], class template adjacent_transform_view synopsis, as indicated:

    namespace std::ranges {
      template<forward_range V, move_constructible F, size_t N>
        requires view<V> && (N > 0) && is_object_v<F> &&
          regular_invocable<F&, REPEAT(range_reference_t<V>, N)...> &&
          can-reference<invoke_result_t<F&, REPEAT(range_reference_t<V>, N)...>>
      class adjacent_transform_view : public view_interface<adjacent_transform_view<V, F, N>> {
        […]
        adjacent_view<V, N> inner_; // exposition only
        
        using InnerView = adjacent_view<V, N>; // exposition only
        […]
      public:
        […]
        constexpr V base() const & requires copy_constructible<VInnerView> { return inner_.base(); }
        constexpr V base() && { return std::move(inner_).base(); }
        […]
      };
    }
    
Date: 2023-11-11.00:00:00

[ 2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP. ]

Date: 2023-10-15.00:00:00

[ 2023-10-27; Reflector poll ]

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

Date: 2023-06-17.00:00:00

In section [range.adjacent.transform.view] the class ranges::adjacent_transform_view got two new base() members from 3848.

The first one looks like

constexpr V base() const & requires copy_constructible<InnerView>
{ return inner_.base(); }

Here the requirement is that InnerView is copy constructible, when it in fact returns an object of type V. That seems odd.

I would expect the constraint to instead be copy_constructible<V>.

History
Date User Action Args
2023-11-13 14:08:10adminsetmessages: + msg13843
2023-11-13 14:08:10adminsetstatus: voting -> wp
2023-11-07 21:41:54adminsetstatus: ready -> voting
2023-10-27 21:22:44adminsetmessages: + msg13762
2023-10-27 21:22:44adminsetstatus: new -> ready
2023-06-25 08:22:49adminsetmessages: + msg13660
2023-06-17 00:00:00admincreate