Title
enumerate_view::iterator and cartesian_product_view::iterator should not always provide iterator_category
Status
new
Section
[range.enumerate.iterator][range.cartesian.iterator]
Submitter
Hewill Kang

Created on 2024-07-07.00:00:00 last changed 5 months ago

Messages

Date: 2024-07-07.17:22:16

Proposed resolution:

This wording is relative to N4981.

  1. Modify [range.enumerate.iterator] as indicated:

    namespace std::ranges {
      template<view V>
        requires range-with-movable-references<V>
      template<bool Const>
      class enumerate_view<V>::iterator {
        using Base = maybe-const<Const, V>;                         // exposition only
    
      public:
        using iterator_category = input_iterator_tag;      // present only if Base
                                                           // models forward_range
        using iterator_concept = see below;
        […]
      };
    }
    
  2. Modify [range.cartesian.iterator] as indicated:

    namespace std::ranges {
      template<input_range First, forward_range... Vs>
        requires (view<First> && ... && view<Vs>)
      template<bool Const>
      class cartesian_product_view<First, Vs...>::iterator {
      public:
        using iterator_category = input_iterator_tag;      // present only if maybe-const<Const, First>
                                                           // models forward_range
        using iterator_concept  = see below;
        […]
      };
    }
    
Date: 2024-07-07.00:00:00

These two iterators do not support *r++ for non-forward iterators, so we should not provide iterator_category as they are not C++17 iterators.

History
Date User Action Args
2024-07-07 17:22:16adminsetmessages: + msg14233
2024-07-07 00:00:00admincreate