Abbreviated Function Templates
Learn how to use a function declaration as a function template using a placeholder.
We'll cover the following...
We'll cover the following...
With C++20, you can use an unconstrained placeholder (auto) or a constrained placeholder (concept) in a function declaration, and this function declaration automatically becomes a function template.
The definitions of the function templates gcd (line 4), gcd1 (line 11), and gcd2 (line 17) are the ones I already presented in section Four Ways to Use a Concept. gcd uses a requires clause, gcd1 a trailing requires clause, and gcd2 a constrained template parameter.
Now to something new. Function template gcd3 has the concept std::integral as a type parameter and becomes, therefore, ...