n**d 发帖数: 9764 | 1 "You can provide default arguments for template parameters in class
templates, but not function templates."
the words are from "Thinking in C++" V2. The first part is easy understood,
which is something like this
template class Stack {...}
But how to understand the 2nd part, "not funtion templates". Is it something
like this, which should be illegal according to this rule?
template T sum(T* a) {...} | k**f 发帖数: 372 | 2 The rule says you can have default *value* such as N=100 in template class,
but in template function you cannot do this. | n**d 发帖数: 9764 | 3 My questionn is how to understand the "words" from the book. N=100 is about
the default parameter, but I don't think the "words" is talking about it. In
fact, you can not have (int N) as function template parameter.
,
【在 k**f 的大作中提到】![](/moin_static193/solenoid/img/up.png) : The rule says you can have default *value* such as N=100 in template class, : but in template function you cannot do this.
|
|