Function template
A function template defines a family of functions.
Syntax
|
template < parameter-list > function-declaration
|
(1)
|
|
|
export template < parameter-list > function-declaration
|
(2)
|
|
|
|
|
|
|
Explanation
Example :
void f(auto (auto::*)(auto)); // #1
template<typename T, typename U, typename V> void f(T (U::*)(V)); // same as #1
template<int N> void f(Array<auto, N>*); // #2 (assuming Array is a class template)
template<int N, typename T> void f(Array<T, N>*); // same as #2
void g1(const C1*, C2&); // #3 (assuming C1 and C2 are concepts
template<C1 T, C2 U> void g1(const T*, U&); // same as #3
No comments:
Post a Comment