[x] For the constructor taking extents and pad, the synopsis calls the second parameter padding_value, while the wording uses pad. Use pad consistently throughout, to avoid confusion and shadowing with the existing padding_value static constexpr member. Ditto for [mdspan.layout.rightpadded].
[mdspan.layout.leftpadded.cons]
[x] para 1: Shouldn't the two default constructors have the same effects? If not, that would be concerning. If so, then we should only need one. (It doesn't matter whether it's = default; it's still user-declared.) Check that and then remove the two different cases. Do constexpr mapping() = default; remove the requires and remove the second default constructor.
[x] para 3 (Mandates): Say that padding_value is representable as index_type, and keep the existing language.
[x] Is it possible to lift the Precondition out as a common case? Not necessary, though. However, a specification macro for "something that is the least multiple of something greater than or equal to something else" could help. (See also https://github.com/ORNL/cpp-proposals-pub/issues/442 .)
(Note: pad = 1 gets you layout_left::mapping.)
(Note: Para 5.1: e.g., long is convertible to int, but that doesn't mean that the value is representable as int.)
[x] Para 6.2: We have lots of Effects like this. We can remove "if static-padding-stride equals dynamic_extent" because we're not forcing use of the optimization (see "Recommended practice"). It's in every constructor; the phrase is repeated, for storing to stride-1. (See e.g., Para 13.2, 17.2.)
[x] Para 8: Specify that Mandates as a bullet list. (In general, if there are three or more points in a sentence, use bullet points.)
[x] Para 12.3: Use parentheses to spell out the order of the divide - times arithmetic expression (verify that left-to-right evaluation was intended).
[x] Para 15: This (converting constructor from LayoutLeftPaddedMapping to layout_left_padded::mapping) doesn't include a rank() > 1 check in the Mandates, unlike other converting constructors. For example, you can always convert from layout_right::mapping if rank() <= 1 (para 19.2). Fix this: Mandates should say if the rank is greater than one, then ... (i.e., add the same prefix as in para 16.1, "If extents_type::rank() > 1 is true").
[x] Para 22, Note: Spell out what "Neither mapping" means (does it refer to the constructor's input or to the two mappings defined in the proposal?).
[mdspan.layout.leftpadded.obs]
[x] Other mdspan layout mappings' constructors require that required_span_size() be representable as index_type. We need that for these two layout mappings as well, else required_span_size() would cause UB since you wouldn't be able to index using index_type. Add this to all the constructors. (See the expression used in Para 2.2.) (LATER NOTE: Not sure what Para 2.2 means, but here is an example: https://eel.is/c++draft/views.multidim#mdspan.layout.stride.cons-1 .) (Also add missing class-wide wording for both layout mappings to match existing layout mappings.)
[mdspan.layout.leftpadded]
pad
, the synopsis calls the second parameterpadding_value
, while the wording usespad
. Usepad
consistently throughout, to avoid confusion and shadowing with the existingpadding_value
static constexpr member. Ditto for [mdspan.layout.rightpadded].[mdspan.layout.leftpadded.cons]
[x] para 1: Shouldn't the two default constructors have the same effects? If not, that would be concerning. If so, then we should only need one. (It doesn't matter whether it's
= default
; it's still user-declared.) Check that and then remove the two different cases. Doconstexpr mapping() = default
; remove therequires
and remove the second default constructor.[x] para 3 (Mandates): Say that
padding_value
is representable asindex_type
, and keep the existing language.[x] Is it possible to lift the Precondition out as a common case? Not necessary, though. However, a specification macro for "something that is the least multiple of something greater than or equal to something else" could help. (See also https://github.com/ORNL/cpp-proposals-pub/issues/442 .)
(Note:
pad = 1
gets youlayout_left::mapping
.)(Note: Para 5.1: e.g., long is convertible to int, but that doesn't mean that the value is representable as int.)
[x] Para 6.2: We have lots of Effects like this. We can remove "if
static-padding-stride
equalsdynamic_extent
" because we're not forcing use of the optimization (see "Recommended practice"). It's in every constructor; the phrase is repeated, for storing tostride-1
. (See e.g., Para 13.2, 17.2.)[x] Para 8: Specify that Mandates as a bullet list. (In general, if there are three or more points in a sentence, use bullet points.)
[x] Para 12.3: Use parentheses to spell out the order of the divide - times arithmetic expression (verify that left-to-right evaluation was intended).
[x] Para 15: This (converting constructor from LayoutLeftPaddedMapping to
layout_left_padded::mapping
) doesn't include arank() > 1
check in the Mandates, unlike other converting constructors. For example, you can always convert fromlayout_right::mapping
ifrank() <= 1
(para 19.2). Fix this: Mandates should say if the rank is greater than one, then ... (i.e., add the same prefix as in para 16.1, "Ifextents_type::rank() > 1
istrue
").[x] Para 22, Note: Spell out what "Neither mapping" means (does it refer to the constructor's input or to the two mappings defined in the proposal?).
[mdspan.layout.leftpadded.obs]
required_span_size()
be representable asindex_type
. We need that for these two layout mappings as well, elserequired_span_size()
would cause UB since you wouldn't be able to index usingindex_type
. Add this to all the constructors. (See the expression used in Para 2.2.) (LATER NOTE: Not sure what Para 2.2 means, but here is an example: https://eel.is/c++draft/views.multidim#mdspan.layout.stride.cons-1 .) (Also add missing class-wide wording for both layout mappings to match existing layout mappings.)Stopping at 4.1.3, para 3, at
operator()
.