P0009: LWG small group review 2022/06/21
@crtrott @dalg24 @nliber
-
Adding
empty()(see PR #262) will require an LEWG paper or NB comment -
noexceptadditions (see PR #262) are OK (?) -
extents(const array&)andextents(span)constructors: RenameSizeType(local) template parameter toOtherSizeType, to prevent shadowing class template parameter -
Change "integral type other than
bool" to "a signed or unsigned integer type" (to exclude character types) -
"is a representable value of type
SizeType" -> "is representable as a value of typeSizeType(2.2, above [mdspan.extents.helpers] -- also update every instance, e.g., [mdspan.extents.ctor] 2.2) (justification: it's not of typeSizeType; it's of some other type) -
para 9, below
extents(const array&): "Preconditions: ..." line is duplicated. -
para 9.2, below
extents(const array&): Could remove the N is zero subcase, as it's redundant. -
para 11:
extents(Integrals...)deduction guide: changesize_typetosize_t(justification: the class doesn't exist yet, sosize_typedoesn't exist) -
[mdspan.layout.reqmts]: for layout mapping
operator(), we also need to say that this is less than or equal tosize_tmax, becausesize_typecould be (e.g.,)__int128and bigger thansize_t. -
(Note on [mdspan.layout.reqmts]: Use of "Result" vs. "Returns" not consistent, but not bad to leave it.)
-
[mdspan.layoutleft.ctor]: para 3 (actually should be 4): change "Preconditions" to "Precondition" (as there is only one precondition); also fix paragraph numbering (three paragraph 3s in this section)
-
[mdspan.layoutleft.obs]: Para 3 (Preconditions on
operator()(Indices... i)): It's just one Precondition, andextents_should be code font, not italics. -
[mdspan.layoutright]: generally apply above
mdspan.layoutleft.*changes to corresponding paragraphs -
[mdspan.layoutstride]: In synopsis and
mapping(const extents_type&, span<SizeType, rank_>), etc.: useOtherSizeTypeinstead ofSizeTypefor consistency -
[mdspan.layoutstride]: Change
constexpr span<const size_type, rank_> strides()to returnarray(by value) instead ofspan, as it was in R16. -
[mdspan.layoutstride.ctor]: Change
SizeTypetoOtherSizeType(see above synopsis notes). -
[mdspan.layoutstride.obs]:
operator(): This wording forbids implementations from detecting out-of-bounds access for integer-like types, because it juststatic_casts tosize_type. It needs tostatic_castin order to support custom (class type) index types. Apply to this and to all layouts:num-cast<size_type>(i)isiifremove_cvref_t<decltype(i)>is an integer-like type, otherwisestatic_cast<size_type>(i). -
mdspan(CArray&)deduction guide: add spaces around==to avoid>==being considered as a single token. -
mdspan(Pointer&)deduction guide: Look again at whether we need lvalue reference; why do we forbid rvalue reference? Do temporary pointers work? Add a test that takesstd::move(CArray)orstd::move(Pointer). -
[mdspan.mdspan.members] para 2 and para 6 (
operator[]): The samestatic_cast<size_type>(std::move(indices))as above; use abovenum-castwording. Move "LetPbe a parameter pack" up sooner, so you can apply that wording. -
mdspan::size()needs to returnsize_t, notsize_type(fixed in overview already, not in description).
-
P2604R0: LWG probably won't like this non-diff form.
-
P2604R0: "two uses of contiguous in prose text in notes will be replaced"
- P2599R1: For additions (not renaming), need to see proper diffs against the paper reviewed in this meeting (R17).
Adding empty() (see PR #262) will require an LEWG paper or NB comment
@mhoemmen @nliber I just finished the paper; the draft is at here, pending a paper number.
Really rushed, the wording was copied from R17.
Feel free to make any comments/suggestions!
Original PR now only contains noexcept stuff. Technically if we want to be safe we can add that to paper too; however I personally do think they are okay to merge on their own.
@Mick235711 you could potentially just inline return size()!=0 instead of adding the description below?
@crtrott There could be a more optimized implementation of empty(), since it doesn't have to compute the size. As specified an implementation has the freedom to do so.
ok sounds good.
My own notes:
From Mark: make extents_ not math font but italic code font [34160ef53b72]
mdspan.extents
-
SizeType -> OtherSizeType for extens constructor from span/array [2972784b3800cd]
-
par 2.1 - SizeType is a signed or unsigned integer type, and [9d1d7e32678dd1e]
-
par 2.2 - or is representable as a value of type SizeType (check for other instances of this) [3532fe13a539cb65]
- mdspan.extents.ctor 2.2
- mdspan.layoutleft.ctor etc.
-
par 9: fix copy paste error [737ec61af5c0fcf]
-
par 11: size_type -> size_t [4dff8c2380b4c03c]
mdspan.layout.reqmts
- par 8. add smaller then
size_ttoo [3c34587d2f6b]
mdspan.layoutleft.ctor
3: fix all the numbers [f0df8c4f5edd0c6]
mdspan.layoutstride.ctor
- SizeType -> OtherSizeType [2972784b3800cd]
- change back strides() -> array<size_type, rank_> [98cf0210f0be4f8c]
mdspan.overview
- SizeType to OtherSizeType for constructors/operator taking span/array [2972784b3800cd]
- spaces around
==rank_v<CArray>==1[54ea3cc232aeb]
mdspan.oberservers
- repeat and fix precondition for indicies from mappings [54ea3cc232aeb] num-cast<size_type>(i) is i if remve_cvref_t<decltype(i)> is integer-like type, otehrwise static_cast<size_type>(i)