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.
layout_transpose do not meet the layout mapping policy requirementsSection: 29.9.10.3 [linalg.transp.layout.transpose], 23.7.3.4.3 [mdspan.layout.policy.reqmts] Status: New Submitter: Charles Hussong Opened: 2026-05-19 Last modified: 2026-05-25
Priority: Not Prioritized
View all issues with New status.
Discussion:
29.9.10.3 [linalg.transp.layout.transpose] bullet (3.2) specifies a Mandate that the rank of the extents used with this layout must equal 2. However, the layout mapping policy requirements at 23.7.3.4.3 [mdspan.layout.policy.reqmts] are worded in the following way:
A type
MPmeets the layout mapping policy requirements if for a typeEthat is a specialization ofextents,MP::mapping<E>is valid and denotes a typeXthat meets the layout mapping requirements (23.7.3.4.2 [mdspan.layout.reqmts]), […]
We interpret this to mean that in order for MP to be a layout mapping policy, it must
be possible to instantiate MP::mapping<E> for any extents E,
with no additional mandates. Since layout_transpose does not satisfy this, specializations
of it do not meet the layout mapping policy, which contradicts 29.9.10.1 [linalg.transp.intro] p1,
and 29.9.10.3 [linalg.transp.layout.transpose] p1, and makes any mdspan using
layout_transpose (including the return type of transposed(29.9.10.4 [linalg.transp.transposed]))
ill-formed.
A type
MPmeets the layout mapping policy requirements if foraat least one typeEthat is a specialization ofextents,MP::mapping<E>is valid and denotes a typeXthat meets the layout mapping requirements […]
Unfortunately this is a much looser requirement, but I'm not sure how else to accommodate a sensible
definition of layout_transpose within the stricter version.
layout_transpose could be redefined to either always transpose the first two or last two ranks.
I did not submit this because it could easily get confusing for users (was it the first two or
the last two, or maybe something else entirely?) and there's no sensible behavior for rank 1.
Another option would be to replace the notion of "meet the layout mapping policy requirements"
with "meet the layout mapping policy requirements for extents E". My understanding is that this
goes against the spirit of the design where the layout mapping policy is not templated on the
specific extents, while the layout mapping is.
Proposed resolution:
This wording is relative to N5046.
Modify 23.7.3.4.3 [mdspan.layout.policy.reqmts] as indicated:
-1- A type
MPmeets the layout mapping policy requirements if foraat least one typeEthat is a specialization ofextents,MP::mapping<E>is valid and denotes a typeXthat meets the layout mapping requirements (23.7.3.4.2 [mdspan.layout.reqmts]), and for which the qualified-idX::layout_typeis valid and denotes the typeMPand the qualified-idX::extents_typedenotesE.