Title
Improve span(R&& r)
Status
new
Section
[span.cons]
Submitter
Hewill Kang

Created on 2025-10-02.00:00:00 last changed 1 week ago

Messages

Date: 2025-10-04.10:45:28

Proposed resolution:

This wording is relative to N5014.

  1. Modify [span.cons] as indicated:

    template<class R> constexpr explicit(extent != dynamic_extent) span(R&& r);
    

    -?- Mandates: If `extent` is not equal to `dynamic_extent` and `ranges::size(r)` is a constant expression, then `ranges::size(r) == extent` is `true`.

    -16- Constraints: Let `U` be remove_reference_t<ranges::range_reference_t<R>>. […]

Date: 2025-10-02.00:00:00

It is preferable to reject span<int, 42>(views::empty<int>) at compile-time after P2280R4, since applying `ranges::size` on those ranges is a constant expression now.

History
Date User Action Args
2025-10-04 10:45:28adminsetmessages: + msg15112
2025-10-02 00:00:00admincreate