cplusplus / cplusplus/draft

The wording "pack" in [temp.variadic]#6 is not clear

Open
#4,081 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

template<typename...T>
struct Test{
   static Test<T...> obj;
};

Consider the above code, T... within Test<T...> is called template-argument-list, thereof , T denotes template-argument which is one form of the following:

template-argument:

  • constant-expression
  • type-id
  • id-expression

Hence, To determine whether T satisfied the requirement of template-argument, the following rule will apply to it.

For the purpose of determining whether a pack satisfies a rule regarding entities other than packs, the pack is considered to be the entity that would result from an instantiation of the pattern in which it appears.

However the definition of wording pack is:

A pack is a template parameter pack, a function parameter pack, or an init-capture pack. The number of elements of a template parameter pack or a function parameter pack is the number of arguments provided for the parameter pack. The number of elements of an init-capture pack is the number of elements in the pack expansion of its initializer.

template parameter pack is:

If a template-parameter is a type-parameter with an ellipsis prior to its optional identifier or is a parameter-declaration that declares a pack ([dcl.fct]), then the template-parameter is a template parameter pack.

The grammar of template-parameter is the following:

template-parameter:

  • type-parameter
  • parameter-declaration

According to these rules, A pack refer to either type-parameter or parameter-declaration . In the example, It means typename...T is called the pack, So I think the wording is not clear or mistake. Maybe change it to:

For the purpose of determining whether the name of a pack satisfies a rule regarding entities other than packs, the name of a pack is considered to be the entity that would result from an instantiation of the pattern in which it appears.

In addition, only a pack expansion will result in instantiation of the pattern.

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

A pack whose name appears within the pattern of a pack expansion is expanded by that pack expansion.

So, I think change the the pack to the name of a pack will make sense

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading [temp.variadic]#6 and the definitions of pack, template parameter pack, and pack expansion quoted in the issue. Compare “the pack” with the proposed “the name of a pack” wording and check surrounding standard terminology; done means a maintainer-approved wording change or a documented decision that the existing text is correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.