Files
2025-10-25 03:02:53 +03:00

64 lines
2.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[temp.constr.fold]
# 13 Templates [[temp]](./#temp)
## 13.5 Template constraints [[temp.constr]](temp.constr#fold)
### 13.5.2 Constraints [[temp.constr.constr]](temp.constr.constr#temp.constr.fold)
#### 13.5.2.5 Fold expanded constraint [temp.constr.fold]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1920)
A [*fold expanded constraint*](#def:constraint,fold_expanded "13.5.2.5Fold expanded constraint[temp.constr.fold]") is formed from a constraint C and
a [*fold-operator*](expr.prim.fold#nt:fold-operator "7.5.7Fold expressions[expr.prim.fold]") which can either be && or ||[.](#1.sentence-1)
A fold expanded constraint is a pack expansion ([[temp.variadic]](temp.variadic "13.7.4Variadic templates"))[.](#1.sentence-2)
Let N be the number of elements
in the pack expansion parameters ([[temp.variadic]](temp.variadic "13.7.4Variadic templates"))[.](#1.sentence-3)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1928)
A fold expanded constraint whose [*fold-operator*](expr.prim.fold#nt:fold-operator "7.5.7Fold expressions[expr.prim.fold]") is && is satisfied if it is a valid pack expansion and
if N=0 or if for each i where 0≤i<N in increasing order,C is satisfied
when replacing each pack expansion parameter
with the corresponding ith element[.](#2.sentence-1)
No substitution takes place for any i greater than
the smallest i for which the constraint is not satisfied[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1938)
A fold expanded constraint whose [*fold-operator*](expr.prim.fold#nt:fold-operator "7.5.7Fold expressions[expr.prim.fold]") is || is satisfied if it is a valid pack expansion,N>0, and if for i where 0≤i<N in increasing order,
there is a smallest i for which C is satisfied
when replacing each pack expansion parameter
with the corresponding ith element[.](#3.sentence-1)
No substitution takes place for any i greater than
the smallest i for which the constraint is satisfied[.](#3.sentence-2)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1948)
[*Note [1](#note-1)*:
If the pack expansion expands packs of different size,
then it is invalid and the fold expanded constraint is not satisfied[.](#4.sentence-1)
— *end note*]
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1954)
Two fold expanded constraints are [*compatible for subsumption*](#def:subsumption,compatible_for "13.5.2.5Fold expanded constraint[temp.constr.fold]") if their respective constraints both contain
an equivalent unexpanded pack ([[temp.over.link]](temp.over.link "13.7.7.2Function template overloading"))[.](#5.sentence-1)