[temp.variadic] Clarify "pack expansion of its initialization"
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
[temp.variadic] p3
An init-capture pack is a lambda capture that introduces an init-capture for each of the elements in the pack expansion of its initializer.
[temp.variadic] p4
The number of elements of an init-capture pack is the number of elements in the pack expansion of its initializer.
So, what does "pack expansion of its initializer" mean? We just define that
A pack expansion consists of a pattern and an ellipsis, ...
A pack whose name appears within the pattern of a pack expansion is expanded by that pack expansion.
In a capture-list ([expr.prim.lambda.capture]); the pattern is the capture without the ellipsis.
For example
template <typename... Args>
void foo(Args... args) {
[...xs=args]{
bar(xs...); // xs is an init-capture pack
};
}
...xs=args is a pack expansion where xs=args is the pattern, we say the pack args is expanded by this pack expansion; =args is the initializer in the init-capture pack. We never define "pack expansion of its initializer". This utterance is obscure in the current draft. Since we say:
An init-capture containing an ellipsis is a pack expansion that declares an init-capture pack
A pack expansion consists of a pattern and an ellipsis, the instantiation of which produces zero or more instantiations of the pattern in a list (described below).
thus, shouldn't we say
An init-capture pack is a lambda capture that introduces an init-capture for each of the elements that resulted from the instantiation of the init-capture that declares it.
?
As well as
The number of elements of an init-capture pack is the number of elements that resulted from the instantiation of its pack expansion.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with [temp.variadic] paragraphs 3–4 and the linked definitions of pack expansion, pattern, and init-capture. Compare the current wording with the proposed wording in the issue, then verify that the revised text clearly describes how init-capture packs and their element counts arise from pack-expansion instantiation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100