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
P0009R18 mdspan #5635
Conversation
There was a problem hiding this 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)$, |
There was a problem hiding this comment.
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 )$
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also: #5647 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
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.
I have applied the obvious formatting suggestions and will go through the rest of the comments separately. |
81ee6f9
to
c3a2d67
Compare
$[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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #5635 (comment).
$[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. |
43b24fa
to
06c095d
Compare
f064628
to
b2a22a8
Compare
Ok, agreed.
|
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. |
f98fc1d
to
7cfdd09
Compare
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`.
7cfdd09
to
4b97cb9
Compare
This fixes cplusplus/papers#1213 and cplusplus/papers#1214 too (those two papers are merged into P0009R17) |
Fixes #5589
Fixes cplusplus/papers#96
Fixes cplusplus/papers#1213
Fixes cplusplus/papers#1214