This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

3335. Resolve C++20 NB comments US 273 and GB 274

Section: 26.2 [ranges.syn] Status: C++20 Submitter: United States/Great Britain Opened: 2019-11-08 Last modified: 2021-02-25

Priority: 1

View other active issues in [ranges.syn].

View all other issues in [ranges.syn].

View all issues with C++20 status.

Discussion:

Addresses US 273/GB 274

US 273:

all_view is not a view like the others. For the other view types, foo_view{args...} is a valid way to construct an instance of type foo_view. However, all_view is just an alias to the type of view::all(arg), which could be one of several different types. all_view feels like the wrong name.

Proposed change:

Suggest renaming all_view to all_t and moving it into the views:: namespace.

GB 274:

Add range_size_t.

LEWG asked that range_size_t be removed from P1035, as they were doing a good job of being neutral w.r.t whether or not size-types were signed or unsigned at the time. Now that we've got a policy on what size-types are, and that P1522 and P1523 have been adopted, it makes sense for there to be a range_size_t.

Proposed change:

Add to [ranges.syn]:

template<range R>
  using range_difference_t = iter_difference_t<iterator_t<R>>;
template<sized_range R>
  using range_size_t = decltype(ranges::size(declval<R&>()));

David Olsen:

The proposed wording has been approved by LEWG and LWG in Belfast.

[2019-11-23 Issue Prioritization]

Priority to 1 after reflector discussion.

[2020-02-10 Move to Immediate Monday afternoon in Prague]

Proposed resolution:

This wording is relative to N4835.

  1. Change 26.2 [ranges.syn], header <ranges> synopsis, as indicated:

    #include <initializer_list>
    #include <iterator>
    
    namespace std::ranges {
      […]
      // 26.4.2 [range.range], ranges
      template<class T>
      concept range = see below;
      […]
      template<range R>
        using range_difference_t = iter_difference_t<iterator_t<R>>;
      template<sized_range R>
        using range_size_t = decltype(ranges::size(declval<R&>()));
      template<range R>
        using range_value_t = iter_value_t<iterator_t<R>>;
      […]
      // 26.7.6.2 [range.ref.view], all view
      namespace views { inline constexpr unspecified all = unspecified; }
        inline constexpr unspecified all = unspecified;
    
        template<viewable_range R>
          using all_tview = decltype(views::all(declval<R>()));
      }
      […]
    }
    
  2. Globally replace all occurrences of all_view with views::all_t. There are 36 occurrences in addition to the definition in the <ranges> synopsis that was changed above.