[temp.constr.fold] (original) (raw)

13 Templates [temp]

13.5 Template constraints [temp.constr]

13.5.2 Constraints [temp.constr.constr]

13.5.2.5 Fold expanded constraint [temp.constr.fold]

A fold expanded constraint is formed from a constraint C and a fold-operatorwhich can either be && or ||.

A fold expanded constraint is a pack expansion ([temp.variadic]).

Let N be the number of elements in the pack expansion parameters ([temp.variadic]).

A fold expanded constraint whose fold-operator is &&is satisfied if it is a valid pack expansion and if or if for each i where in increasing order,C is satisfied when replacing each pack expansion parameter with the corresponding element.

No substitution takes place for any i greater than the smallest i for which the constraint is not satisfied.

A fold expanded constraint whose fold-operator is ||is satisfied if it is a valid pack expansion,, and if for i where in increasing order, there is a smallest i for which C is satisfied when replacing each pack expansion parameter with the corresponding element.

No substitution takes place for any i greater than the smallest i for which the constraint is satisfied.

[Note 1:

If the pack expansion expands packs of different size, then it is invalid and the fold expanded constraint is not satisfied.

— _end note_]

Two fold expanded constraints are compatible for subsumptionif their respective constraints both contain an equivalent unexpanded pack ([temp.over.link]).