Skip to content

Commit e5a30fe

Browse files
lprvtkoeppe
authored andcommitted
[temp.constr.concept] Fix example
* Give all template parameters a unique name for clarity * Replace use a of a reserved identifier * Fix the example's accompanying text, in particular the parameter mapping of the normal form of the concept-id after substitution
1 parent a5b2951 commit e5a30fe

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

source/templates.tex

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,6 @@
18911891
Checking whether \tcode{CI$''$} is satisfied
18921892
can lead to further normalization of concept-dependent constraints.
18931893
\end{note}
1894-
%FIXME: "_" in the example below is not a valid identifier.
18951894
\begin{example}
18961895
\begin{codeblock}
18971896
template<typename>
@@ -1900,22 +1899,22 @@
19001899
template<typename T, template<typename> concept CC>
19011900
concept D = CC<T>;
19021901

1903-
template<typename T,
1902+
template<typename U,
19041903
template<typename> concept CT,
19051904
template<typename, template<typename> concept> concept CU>
1906-
int f() requires CU<T, CT>;
1907-
int _ = f<int, C, D>();
1908-
\end{codeblock}
1909-
In this example, the associated constraint of \tcode{f}
1910-
is a concept-dependent constraint $CI$
1911-
whose expression is the concept-id \tcode{CU<T, CT>} with the mapping
1912-
$\tcode{T} \mapsto \tcode{T}, \tcode{CT} \mapsto \tcode{CT}, \tcode{CU} \mapsto \tcode{CU}$.\\
1913-
$CI'$ is the result of substituting \tcode{D} into $CI$.\\
1914-
We consider the normal form $CI''$ of \tcode{D<T, CT>},
1905+
int f() requires CU<U, CT>;
1906+
int i = f<int, C, D>();
1907+
\end{codeblock}
1908+
In this example, the associated constraints of \tcode{f}
1909+
consist of a concept-dependent constraint
1910+
whose expression is the concept-id \tcode{CU<U, CT>} with the mapping
1911+
$\tcode{U} \mapsto \tcode{U}, \tcode{CT} \mapsto \tcode{CT}, \tcode{CU} \mapsto \tcode{CU}$.
1912+
The result of substituting \tcode{D} into this expression is \tcode{D<U, CT>}.
1913+
We consider the normal form of the resulting concept-id,
19151914
which is \tcode{CC<T>} with the mapping
1916-
$\tcode{T} \mapsto \tcode{T}, \tcode{CC} \mapsto \tcode{CC}$.\\
1917-
By recursion, \tcode{C} is substituted in \tcode{CC<T>} and then
1918-
normalized to the atomic constraint \tcode{true}, which is satisfied.
1915+
$\tcode{T} \mapsto \tcode{U}, \tcode{CC} \mapsto \tcode{CT}$.
1916+
By recursion, \tcode{C} is substituted into \tcode{CC<T>}, and the result
1917+
is normalized to the atomic constraint \tcode{true}, which is satisfied.
19191918
\end{example}
19201919

19211920
\rSec3[temp.constr.fold]{Fold expanded constraint}

0 commit comments

Comments
 (0)