Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P0009R18 mdspan #5635

Merged
merged 1 commit into from Aug 11, 2022
Merged

P0009R18 mdspan #5635

merged 1 commit into from Aug 11, 2022

Conversation

jensmaurer
Copy link
Member

@jensmaurer jensmaurer commented Jul 22, 2022

  • Rephrase "may" in notes

Fixes #5589
Fixes cplusplus/papers#96
Fixes cplusplus/papers#1213
Fixes cplusplus/papers#1214

@jensmaurer jensmaurer added this to the post-2022-07 milestone Jul 22, 2022
Copy link
Contributor

@JohelEGP JohelEGP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do index-cast and the mapping's operator() not use std::move, like the operator[] that uses index-cast?

\pnum
A \defnadj{multidimensional}{index space} is
a Cartesian product of integer intervals.
Each interval can be represented by a half-open range $[L_i, U_i)$,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use \range? Same everywhere for all text that beings with $[ and ends with )$.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\range is for iterator ranges, and puts its start and end into \tcode. The ranges discussed here are not iterator ranges.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's examples of non-iterator ranges and the use of math fonts for its arguments.

algorithms.tex:where \tcode{n} is the smallest integer in \range{0}{$N$} such that $E$ holds,
algorithms.tex:$E(i)$, where $i$ is the smallest integer in \range{0}{$N$}
algorithms.tex:For each integer \tcode{K} in \range{0}{last - first}
algorithms.tex:For each integer \tcode{K} in \range{0}{last - first}
algorithms.tex:For each integer \tcode{K} in \range{0}{last - first}
algorithms.tex:For each integer \tcode{K} in \range{0}{last - first}
iterators.tex:If \tcode{n > 0}, \range{i}{bound} denotes a range.
iterators.tex:If \tcode{n == 0}, \range{i}{bound} or \range{bound}{i} denotes a range.
iterators.tex:If \tcode{n < 0}, \range{bound}{i} denotes a range,
threads.tex:For all \tcode{i} in \range{0}{sizeof...(MutexTypes)},
utilities.tex:for all \tcode{i} in the range \range{0}{N}.
utilities.tex:\range{0}{sizeof...(Types)} in order, $\tcode{T}_i$
utilities.tex:In the function descriptions that follow, let $i$ be in the range \range{0}{sizeof...\brk{}(Types)}
utilities.tex:In the descriptions that follow, let $i$ be in the range \range{0}{sizeof...(Types)},

expressions.tex:\crange{-32768}{+32767}, the implementation cannot rewrite this
strings.tex:\tcode{i} in \crange{0}{size()}.
strings.tex:\tcode{i} in \crange{0}{size()}.
time.tex:The value held is unspecified if \tcode{d} is not in the range \crange{0}{255}.
time.tex:The value held is unspecified if \tcode{m} is not in the range \crange{0}{255}.
time.tex:always produces a remainder in the range of \crange{0}{11}.
time.tex:this operation results in a \tcode{month} holding a value in the range \crange{1}{12} even if \tcode{!x.ok()}.
time.tex:in the range \crange{months\{0\}}{months\{11\}}
time.tex:It can represent values in the range \crange{min()}{max()}.
time.tex:The value held is unspecified if \tcode{y} is not in the range \crange{-32767}{32767}.
time.tex:The value held is unspecified if \tcode{wd} is not in the range \crange{0}{255}.
time.tex:always produces a remainder in the range of \crange{0}{6}.
time.tex:this operation results in a \tcode{weekday} holding a value in the range \crange{0}{6} even if \tcode{!x.ok()}.
time.tex:in the range \crange{days\{0\}}{days\{6\}}
time.tex:The values held are unspecified if \tcode{!wd.ok()} or \tcode{index} is not in the range \crange{0}{7}.
time.tex:A \tcode{sys_days} in the range \crange{days\{-12687428\}}{days\{11248737\}}
time.tex:and \tcode{d_} is in the range \crange{1d}{(y_/m_/last).day()},
time.tex:If \tcode{ymd.day()} is in the range \crange{1d}{28d},
time.tex:and \tcode{ymd.day()} is not in the range \crange{1d}{28d},
time.tex:of the smallest possible integer in the range \crange{0}{18} such that
time.tex:The 12-hour equivalent of \tcode{h} in the range \crange{1h}{12h}.
time.tex:If \tcode{h} is not in the range \crange{0h}{23h},
time.tex:in the range \crange{0h}{11h},
time.tex:in the range \crange{12h}{23h},
time.tex:If \tcode{h} is not in the range \crange{1h}{12h},
time.tex:values in the range \crange{69}{99}
time.tex:and values in the range \crange{00}{68}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering the same. I thought our range macros were for all kinds of ranges, not just iterators. By contrast, there's nothing "code" about [a, b], and for a half-open range [a, b) would look outright weird, supposing that you associate "code font" with "balanced parentheses".

We can leave this as an open issue though, if this is controversial.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also: #5647 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I misread, there's no code font involved here -- rather, it's whether we should manually spell out ranges in maths, or use a macro. That distinction seems to be largely unobservable in the output, so we can think about that later and consider the arguments for and against.

source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
@jensmaurer
Copy link
Member Author

I have applied the obvious formatting suggestions and will go through the rest of the comments separately.

Comment on lines +16878 to +16893
$[0, n)$ is an accessible range for
an object \tcode{p} of type \tcode{pointer} and
an object of type \tcode{default_accessor}
if and only if \range{p}{p + $n$} is a valid range.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #5635 (comment).

Suggested change
$[0, n)$ is an accessible range for
an object \tcode{p} of type \tcode{pointer} and
an object of type \tcode{default_accessor}
if and only if \range{p}{p + $n$} is a valid range.
$[0, \tcode{n})$ is an accessible range for
an object \tcode{p} of type \tcode{pointer} and
an object of type \tcode{default_accessor}
if and only if \range{p}{p + n} is a valid range.

source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
source/containers.tex Outdated Show resolved Hide resolved
@jensmaurer jensmaurer force-pushed the motions-2022-07-lwg-2 branch 2 times, most recently from 43b24fa to 06c095d Compare July 29, 2022 06:51
source/containers.tex Outdated Show resolved Hide resolved
@tkoeppe tkoeppe force-pushed the motions-2022-07-lwg-2 branch 4 times, most recently from f064628 to b2a22a8 Compare August 11, 2022 21:12
@jensmaurer
Copy link
Member Author

jensmaurer commented Aug 11, 2022 via email

@tkoeppe
Copy link
Contributor

tkoeppe commented Aug 11, 2022

Just some minor whitespace tweaking, then we're off. And I'll send a follow-up PR to propose using "rank index" more instead of spelling out intervals.

@tkoeppe tkoeppe force-pushed the motions-2022-07-lwg-2 branch 2 times, most recently from f98fc1d to 7cfdd09 Compare August 11, 2022 21:28
Editorial changes:
 - Rephrase "may" in notes.
 - Give expression `sizeof...(OtherSizeTypes)` a name (`N`) to
   simplify the presentation.
 - Change "for all rank index `r`" to "for every rank index `r`".
 - Drop some extraneous parentheses.
 - Spell non-type template parameter `Args`, not `args`.
@tkoeppe tkoeppe merged commit b94f23a into main Aug 11, 2022
@Mick235711
Copy link
Contributor

This fixes cplusplus/papers#1213 and cplusplus/papers#1214 too (those two papers are merged into P0009R17)

@jensmaurer jensmaurer deleted the motions-2022-07-lwg-2 branch November 18, 2022 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants