cplusplus / cplusplus/draft

[temp.names] p9 The process of the parameter mapping is omitted

Open
#5,459 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

[temp.names] p9 says

A concept-id evaluates to true if the concept's normalized constraint-expression ([temp.constr.decl]) is satisfied ([temp.constr.constr]) by the specified template arguments and false otherwise.

Consider this example:

template<std::size_t N>
concept GreaterThanZero = N > 0;

template<std::size_t I>
requires (!GreaterThanZero< I - 1>) void fun(){}

fun<1>();

According to [temp.constr.normal] p1

The normal form of an expression E is a constraint that is defined as follows:

  • The normal form of an expression ( E ) is the normal form of E.
  • [...]
  • [...]
  • The normal form of a concept-id C<A1, A2,..., An> is the normal form of the constraint-expression of C, after substituting A1, A2,..., An for C's respective template parameters in the parameter mappings in each atomic constraint. If any such substitution results in an invalid type or expression, the program is ill-formed; no diagnostic is required.
    the constraint of the declaration is defined as
  • The normal form of any other expression E is the atomic constraint whose expression is E and whose parameter mapping is the identity mapping.

For this case, only the first and the last bullet applies to (!GreaterThanZero<I - 1>) and !GreaterThanZero<I - 1>, respectively, and !GreaterThanZero<N> is regarded as an atomic constraint. When determining whether such an atomic is satisfied or not, the concept-id GreaterThanZero<N> is therefore evaluated. However, [temp.names] p9 only says the normalization of the constraint-expression of the concept, in this case, it's N > 0. We lack to specify the parameter mapping as specified in the fourth bullet, namely mapping N ↦ I -1 for the normalization of a concept-id<A1,A2,..., An>.

Should we just say

A concept-id evaluates to true if the normalization of the concept-id is satisfied and false otherwise.

This can make the parameter mapping in the atomic constraints more clear. The whole process of determination of satisfication is consistent with other subclasses.

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 with [temp.names] p9 and compare its concept-id satisfaction wording with [temp.constr.normal] p1, especially the parameter-mapping rule. Trace the example's mapping from N to I - 1 and determine how the draft should express that relationship. Done means the wording makes the mapping process explicit and consistent with constraint normalization.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.