Date
2020-02-15.00:00:00
Message id
10947

Content

[ 2020-02-10; Prague 2020; Casey comments and provides alternative wording ]

The fundamental issue here is that both ranges::size and view_interface::size (it should be unsurprising that many of the "default" implementations of member meow in view_interface look just like fallback cases of the ranges::meow CPO) have a case that returns the difference of ranges::end and ranges::begin. If begin and end are amortized* O(1) but not "true" O(1), then the resulting size operation is amortized O(1) and not "true" O(1) as required by the sized_range concept. I don't believe we can or should fix this on a case by case basis, but we should instead relax the complexity requirement for sized_range to be handwavy-amortized O(1).

Previous resolution [SUPERSEDED]:

This wording is relative to N4849.

  1. Add the following specialization to [ranges.syn]:

    // [drop.while.view], drop while view
      template<view V, class Pred>
        requires input_range<V> && is_object_v<Pred> &&
          indirect_unary_predicate<const Pred, iterator_t<V>>
        class drop_while_view;
    
    
      template<view V, class Pred>
        inline constexpr bool disable_sized_range<drop_while_view<V, Pred>> = true;
    
    
      namespace views { inline constexpr unspecified drop_while = unspecified; }