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

[tuple.creation] Simplify the introductory notation, and then use notation that matches the introduction. #1251

Merged
merged 1 commit into from Feb 5, 2017

Conversation

tkoeppe
Copy link
Contributor

@tkoeppe tkoeppe commented Dec 15, 2016

Here is a slight simplification of [tuple.creation]. I bugged me that the introduction was defining things that were only tangentially useful. I changed it to introduce the concept of indexing into a pack only once, and I used the "variable-pack" notation (e.g. TTypes, VTypes) in all the functions in this subclause.

I will work on tuple_cat separately.

Before:

image

After:

image

@tkoeppe
Copy link
Contributor Author

tkoeppe commented Dec 15, 2016

If you like this general direction, I could rephrase tuple_cat to have template parameter TupleTypes and say that Tuple_i is tuple<ArgTypes_i>, etc.

@tkoeppe
Copy link
Contributor Author

tkoeppe commented Dec 15, 2016

@jwakely: I'd appreciate your feedback.

@jensmaurer
Copy link
Member

Seems like an improvement to me.

@jensmaurer
Copy link
Member

@tkoeppe: We have merge conflicts here.

@jwakely
Copy link
Member

jwakely commented Jan 12, 2017

Yes, I think this is an improvement. I'm not keen on putting "where indexing is zero-based" in parentheses though, I preferred the original form.

@tkoeppe
Copy link
Contributor Author

tkoeppe commented Jan 12, 2017

@jwakely: Yes, I agree, I'll unparenthesize that.

@tkoeppe
Copy link
Contributor Author

tkoeppe commented Jan 13, 2017

@jwakely: Done.

@@ -2047,7 +2040,7 @@
\indexlibrary{\idxcode{tuple_cat}}
\begin{itemdecl}
template <class... Tuples>
constexpr tuple<@\placeholder{CTypes}@...> tuple_cat(Tuples&&... tpls);
constexpr tuple<CTypes...> tuple_cat(Tuples&&... tpls);
\end{itemdecl}

\begin{itemdescr}
Copy link
Member

Choose a reason for hiding this comment

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

The following description uses italic teletype T_i for elements of Tuples, which seems inconsistent with the changes made above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zygoloid: I hadn't revised tuple_cat at all, and that was still the original formatting. I've now added a complete review of this description to the PR.

parameter in the function parameter pack \tcode{tpls}, where all indexing is
zero-based.

\pnum
\requires For all $i$, $\tcode{U}_i$ shall be the type
$\cv_i$ \tcode{tuple<$Args_i...$>}, where $\cv_i$ is the (possibly empty) $i^{th}$
cv-qualifier-seq and $Args_i$ is the parameter pack representing the element
types in $\tcode{U}_i$. Let ${A_{ik}}$ be the ${k_i}^{th}$ type in $Args_i$. For all
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please note that "k_i^th type" doesn't make sense - it should be "k^th type".

Copy link
Member

Choose a reason for hiding this comment

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

While I agree, I'm also happier leaving that alone for now as you have done. I think using k_i is merely confusing rather than wrong.

@@ -2047,39 +2040,44 @@
\indexlibrary{\idxcode{tuple_cat}}
\begin{itemdecl}
template <class... Tuples>
constexpr tuple<@\placeholder{CTypes}@...> tuple_cat(Tuples&&... tpls);
Copy link
Member

Choose a reason for hiding this comment

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

CTypes is still italicized in the synopsis. (Likewise for make_tuple.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, yes; I change the synopsis to match all the changes in this section.

\tcode{is_constructible_v<$A_{ik}$, $cv_i$ $A_{ik}$\&> == true}, otherwise
\tcode{is_constructible_v<$A_{ik}$, $cv_i A_{ik}$\&\&> == true}.
$\cv_i$ \tcode{tuple<$\tcode{Args}_i$...>}, where $\cv_i$ is the (possibly empty) $i^\text{th}$
cv-qualifier-seq and $\tcode{Args}_i$ is the parameter pack representing the element
Copy link
Member

Choose a reason for hiding this comment

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

\grammarterm for cv-qualifier-seq, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

... but that doesn't make sense, since there is no such grammar element here. Perhaps it means that $\cv_i$ are the cv-qualifiers of $\tcode{T}_i$, but I'm not really sure. Let's make the formatting fix to italicize the grammar term cv-qualifier-seq here and file an LWG issue asking for this description to be revisited.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, that's already applied then.

$\tcode{A}_{ik}$ the following requirements shall be satisfied:
\begin{itemize}
\item If $\tcode{T}_i$ is deduced as an lvalue reference type, then
\tcode{is_constructible_v<$A_{ik}$, $cv_i\;A_{ik}$\&> == true}, otherwise
Copy link
Member

Choose a reason for hiding this comment

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

Missing tcode for A here and on the line below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants