You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
[temp.names] p9 says
Consider this example:
According to [temp.constr.normal] p1
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-idGreaterThanZero<N>
is therefore evaluated. However, [temp.names] p9 only says the normalization of the constraint-expression of the concept, in this case, it'sN > 0
. We lack to specify the parameter mapping as specified in the fourth bullet, namely mappingN ↦ I -1
for the normalization of aconcept-id<A1,A2,..., An>
.Should we just say
This can make the parameter mapping in the atomic constraints more clear. The whole process of determination of satisfication is consistent with other subclasses.
The text was updated successfully, but these errors were encountered: