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

3298. Range adaptors introduced by P1035 do not require viewable_range

Section: 26.7.11.2 [range.take.while.view], 26.7.12.2 [range.drop.view], 26.7.13.2 [range.drop.while.view] Status: NAD Submitter: Christopher Di Bella Opened: 2019-09-24 Last modified: 2020-09-06

Priority: Not Prioritized

View all other issues in [range.take.while.view].

View all issues with NAD status.

Discussion:

After adoption of P1035 range adaptor closure is described to take a viewable_range as input, and return a view as output. The deduction-guides for take_while_view, drop_view, and drop_while_view do not currently impose the viewable_range requirement.

[2020-02 Status to NAD on Thursday morning in Prague.]

Proposed resolution:

This wording is relative to N4830.

  1. Modify 26.7.11.2 [range.take.while.view], class template take_while_view synopsis, as indicated:

    namespace std::ranges {
      […]
      template<classinput_range R, class Pred>
        requires viewable_range<R> && 
            indirect_unary_predicate<const Pred, iterator_t<R>>
          take_while_view(R&&, Pred) -> take_while_view<all_view<R>, Pred>;
    }
    
  2. Modify 26.7.12.2 [range.drop.view], class template drop_view synopsis, as indicated:

    namespace std::ranges {
      […]
      template<classinput_range R>
        requires viewable_range<R>
          drop_view(R&&, range_difference_t<R>) -> drop_view<all_view<R>>;
    }
    
  3. Modify 26.7.13.2 [range.drop.while.view], class template drop_while_view synopsis, as indicated:

    namespace std::ranges {
      […]
      template<classinput_range R, class Pred>
        requires viewable_range<R> && 
            indirect_unary_predicate<const Pred, iterator_t<R>>
          drop_while_view(R&&, Pred) -> drop_while_view<all_view<R>, Pred>;
    }