ORNL / ORNL/cpp-proposals-pub

P0009: LWG small group review 2022/06/21

Open
#266 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
29
Forks
26
PR merge metrics
No merged PRs in 30d

Description

@crtrott @dalg24 @nliber

  • Adding empty() (see PR #262) will require an LEWG paper or NB comment

  • noexcept additions (see PR #262) are OK (?)

  • extents(const array&) and extents(span) constructors: Rename SizeType (local) template parameter to OtherSizeType, 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 type SizeType (2.2, above [mdspan.extents.helpers] -- also update every instance, e.g., [mdspan.extents.ctor] 2.2) (justification: it's not of type SizeType; 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: change size_type to size_t (justification: the class doesn't exist yet, so size_type doesn't exist)

  • [mdspan.layout.reqmts]: for layout mapping operator(), we also need to say that this is less than or equal to size_t max, because size_type could be (e.g.,) __int128 and bigger than size_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, and extents_ 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.: use OtherSizeType instead of SizeType for consistency

  • [mdspan.layoutstride]: Change constexpr span<const size_type, rank_> strides() to return array (by value) instead of span, as it was in R16.

  • [mdspan.layoutstride.ctor]: Change SizeType to OtherSizeType (see above synopsis notes).

  • [mdspan.layoutstride.obs]: operator(): This wording forbids implementations from detecting out-of-bounds access for integer-like types, because it just static_casts to size_type. It needs to static_cast in order to support custom (class type) index types. Apply to this and to all layouts: num-cast<size_type>(i) is i if remove_cvref_t<decltype(i)> is an integer-like type, otherwise static_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 takes std::move(CArray) or std::move(Pointer).

  • [mdspan.mdspan.members] para 2 and para 6 (operator[]): The same static_cast<size_type>(std::move(indices)) as above; use above num-cast wording. Move "Let P be a parameter pack" up sooner, so you can apply that wording.

  • mdspan::size() needs to return size_t, not size_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).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by comparing the R17 paper with PR #262, then review the listed [mdspan] sections and the P2604R0 and P2599R1 notes. Done means resolving the open design questions, applying the requested wording and consistency changes, and producing proper diffs against the reviewed paper.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.