[temp.constr.concept] # 13 Templates [[temp]](./#temp) ## 13.5 Template constraints [[temp.constr]](temp.constr#concept) ### 13.5.2 Constraints [[temp.constr.constr]](temp.constr.constr#temp.constr.concept) #### 13.5.2.4 Concept-dependent constraints [temp.constr.concept] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1857) A [*concept-dependent constraint*](#def:constraint,concept-dependent "13.5.2.4 Concept-dependent constraints [temp.constr.concept]") CD is an atomic constraint whose expression is a concept-id CI whose[*concept-name*](temp.concept#nt:concept-name "13.7.9 Concept definitions [temp.concept]") names a dependent concept named C[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1862) To determine if CD is[*satisfied*](#def:constraint,satisfaction,concept-dependent "13.5.2.4 Concept-dependent constraints [temp.constr.concept]"), the parameter mapping and template arguments are first substituted into C[.](#2.sentence-1) If substitution results in an invalid concept-id in the immediate context of the constraint ([[temp.deduct.general]](temp.deduct.general "13.10.3.1 General")), the constraint is not satisfied[.](#2.sentence-2) Otherwise, let CI′ be the normal form ([[temp.constr.normal]](temp.constr.normal "13.5.4 Constraint normalization")) of the concept-id after substitution of C[.](#2.sentence-3) [*Note [1](#note-1)*: Normalization of CI might be ill-formed; no diagnostics is required[.](#2.sentence-4) — *end note*] [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1877) To form CI′′, each appearance of C's template parameters in the parameter mappings of the atomic constraints (including concept-dependent constraints) in CI′ is substituted with their respective arguments from the parameter mapping of CD and the arguments of CI[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L1886) CD is satisfied if CI′′ is satisfied[.](#4.sentence-1) [*Note [2](#note-2)*: Checking whether CI′′ is satisfied can lead to further normalization of concept-dependent constraints[.](#4.sentence-2) — *end note*] [*Example [1](#example-1)*: templateconcept C = true; template concept CC>concept D = CC; template concept CT, template concept> concept CU>int f() requires CU;int i = f(); In this example, the associated constraints of f consist of a concept-dependent constraint whose expression is the concept-id CU with the mappingU↦U,CT↦CT,CU↦CU[.](#4.sentence-3) The result of substituting D into this expression is D[.](#4.sentence-4) We consider the normal form of the resulting concept-id, which is CC with the mappingT↦U,CC↦CT[.](#4.sentence-5) By recursion, C is substituted into CC, and the result is normalized to the atomic constraint true, which is satisfied[.](#4.sentence-6) — *end example*]