Hi Yuan,


isn't the aim (or one of it) of generic programming to use function templates as a function and especially class templates as a class?


C++ supports this with deeply. For example template arguments are deduced not only directly from a parameter, but also indirectly from a deeper level:


Not only


template<class C> function void f(C)


is possible, but also


template<class C> function void f(vector<C>)


You can have template functions as types/parameters and as member functions of classes.


You cannot take the single address of a template function, because at that level the template function is separated/resolved into actual functions.


You say, a "protocol" is a function in a truer sense than a template function. In what ways and where is this useful?





On Saturday, August 20th, 2022 at 6:27 AM, Jason McKesson via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

I don't know why "concept model" is brought
up here. A generic function is a form of
function, in the way "member function" being
a form of a function. A function template is
a form of a template, not even a function.
If you want to constrain a template, use
a concept. To declare a generic function,
you need a protocol, just like to use subtype
polymorphism, you need a type with virtual