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

4397. Improve span(R&& r)

Section: 23.7.2.2.2 [span.cons] Status: New Submitter: Hewill Kang Opened: 2025-10-02 Last modified: 2025-10-04

Priority: Not Prioritized

View all other issues in [span.cons].

View all issues with New status.

Discussion:

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.

Proposed resolution:

This wording is relative to N5014.

  1. Modify 23.7.2.2.2 [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>>. […]