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
[move.iterators] Various (hopefully) editorial fixes #2582
Conversation
Increased the scope of the PR. My first attempt to the fix in the second commit was wrong, so there's some noise. |
source/iterators.tex
Outdated
@@ -4406,7 +4406,7 @@ | |||
\begin{itemdescr} | |||
\pnum | |||
\constraints | |||
The expression \tcode{x + n} shall be valid and have type \tcode{Iterator}. | |||
The expression \tcode{x + n} shall be valid. |
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.
The intent here is "The expression \tcode{x.base() + n}
shall be valid and have type \tcode{Iterator}
." Admittedly it's weird to constrain n + move_iterator
when move_iterator + n
isn't constrained; I'll open an LWG issue to constrain the member operators similarly.
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.
...and while I'm here, thanks for the incredibly detailed review of and corrections to the Ranges wording.
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.
The intent here is "The expression
\tcode{x.base() + n}
shall be valid and have type\tcode{Iterator}
." Admittedly it's weird to constrainn + move_iterator
whenmove_iterator + n
isn't constrained; I'll open an LWG issue to constrain the member operators similarly.
Right. I hoped that [move.iter.requirements] did that job.
...and while I'm here, thanks for the incredibly detailed review of and corrections to the Ranges wording.
Sure :)
source/iterators.tex
Outdated
template<class Iterator, SizedSentinel<Iterator> S> | ||
constexpr iter_difference_t<Iterator> operator-( | ||
const move_iterator<Iterator>& x, const move_sentinel<S>& y); | ||
|
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.
These operators are very much intentionally hidden friends for the effect on name lookup. This change is not editorial.
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.
Thank you. I guess that's the case for all the friends added?
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.
Yes, that is the case.
@@ -4406,7 +4406,7 @@ | |||
\begin{itemdescr} | |||
\pnum | |||
\constraints | |||
The expression \tcode{x + n} shall be valid and have type \tcode{Iterator}. | |||
The expression \tcode{x.base() + n} shall be valid and have type \tcode{Iterator}. | |||
|
|||
\pnum | |||
\returns \tcode{x + n}. |
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.
This change creates an inconsistency between the constraints and the returned value.
move_iterator:::operator+(difference_type)
has no constraints, so the expression in question is always valid (even though instantiation of the operator might fail), so presumably we're missing a constraint around [move.iter.nav]p7? Whether or not this expression is SFINAEable is not editorial, and the current specification appears to be normatively wrong, so I think this part needs to go to LWG.
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.
http://wg21.link/LWG3293 attempts to solve this.
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 for the reminder that I need to fix this issue's P/R.
The former change is handled by https://wg21.link/LWG3293 (P3) and the latter is in the draft. |
Hopefully the intention is crystal clear and this can be handled editorially.