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.

4275. std::dynamic_extent should also be defined in <mdspan>

Section: 23.7.3.2 [mdspan.syn] Status: New Submitter: Aiden Grossman Opened: 2025-06-06 Last modified: 2025-06-10

Priority: Not Prioritized

View all other issues in [mdspan.syn].

View all issues with New status.

Discussion:

std::dynamic_extent can be used in certain circumstances in std::mdspan, such as with padded layouts. However, std::dynamic_extent is currently only defined in <span> which necessitates including <span> solely for the std::dynamic_extent definition.

Previous resolution [SUPERSEDED]:

This wording is relative to N5008.

  1. Modify 23.7.3.2 [mdspan.syn], header <span> synopsis, as indicated:

    // all freestanding
    namespace std {
      // constants
      inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
      
      // 23.7.3.3 [mdspan.extents], class template extents
      template<class IndexType, size_t... Extents>
      class extents;
    
      […]
    }
    

[2025-06-10; Jonathan provides improved wording]

Proposed resolution:

This wording is relative to N5008.

  1. Modify 23.7.1 [views.general] as indicated:

    The header <span> (23.7.2.1 [span.syn]) defines the view span. The header <mdspan> (23.7.3.2 [mdspan.syn]) defines the class template mdspan and other facilities for interacting with these multidimensional views.

    -?- In addition to being available via inclusion of the <span> header, dynamic_extent is available when the header <mdspan> is included.