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

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

Messages

Date: 2025-10-20.16:15:31

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-15.00:00:00

[ 2025-10-20; Reflector poll. ]

Set priority to 3 after reflector poll.

The opinions on reflector discussion where split regarding, if this should be considered LEWG matter.

Question was raised, if ranges::size(r) == N is required to be usable at compile-time for integer-class types.

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-20 16:15:31adminsetmessages: + msg15279
2025-10-04 10:45:28adminsetmessages: + msg15112
2025-10-02 00:00:00admincreate