ericniebler / stl2

LaTeX and Markdown source for the Ranges TS/STL2 and associated proposals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add range_size_t

cjdb opened this issue · comments

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 resolution

Add to [ranges.syn]:

  template<Range R>
  using range_difference_t = iter_difference_t<iterator_t<R>>;

+ template<SizedRange R>
+   using range_size_t = decltype(ranges::size(declval<R&>()));

I would expect only SizedRanges to have a range_size_t, and it should be the return type of ranges::size. I wouldn't expect there to be an iter_size_t.

Good points. Updated accordingly.

I think it should be declval<R&>().

Closed by application of LWG-3335 to the C++20 working draft in Prague.