Title
join_view<V>::iterator<true> tries to write through const join_view ptr
Status
new
Section
[range.join.view]
Submitter
Eric Niebler

Created on 2019-09-09.00:00:00, last changed 2019-10-07.02:21:30.

Messages

Date: 2019-10-07.02:21:30

Proposed resolution:

This wording is relative to N4830.

  1. Modify [range.join.view], class template join_view synopsis, as indicated:

    [Drafting note: Changing the join_view<V>::inner_ member to be mutable is safe because this exposition-only member is only used when the join_view is single-pass and only modified by operations that invalidate other iterators]

    namespace std::ranges {
      template<input_range V>
        requires view<V> && input_range<range_reference_t<V>>> &&
                (is_reference_v<range_reference_t<V>> ||
                view<range_value_t<V>>)
      class join_view : public view_interface<join_view<V>> {
      private:
        […]
        V base_ = V(); // exposition only
        mutable all_view<InnerRng> inner_ = // exposition only, present only when 
                                            // !is_reference_v<InnerRng>
          all_view<InnerRng>();
      public:
        […]
      };
    }
    
Date: 2019-10-07.02:21:30

[ 2019-10 Priority set to 2 after reflector discussion ]

Date: 2019-09-09.00:00:00

The non-const join_view::begin() returns iterator<simple-view<V>>. If simple-view<V> is true, then the iterator stores a const join_view* named parent_. iterator::satisfy() will try to write to parent_->inner_ if ref_is_glvalue is false. That doesn't work because the inner_ field is not marked mutable.

History
Date User Action Args
2019-10-07 02:21:30adminsetmessages: + msg10681
2019-09-15 12:42:55adminsetmessages: + msg10627
2019-09-09 00:00:00admincreate