由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Default function template arguments
相关主题
ajax小问题C里面有没有default argument这么一说,是不是只有在C++里有这个feature?
static如何作为函数?A simple question on Flex
interview questionsgdb里怎么call member function
问一个C++问题:default parameter and overriding/inheritanc (转载)[合集] Inline member function in C++
C++ template function default argument 很怪?Calling order of functions as arguments
one more interview questionfunction declaration
Question: How to store initialize arguments?c的函数指针能不能弄得像matlab的function handle一样?
来几个C++测试题python 问题,急,在线等。
相关话题的讨论汇总
话题: template话题: default话题: class话题: templates话题: function
进入Programming版参与讨论
1 (共1页)
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 的大作中提到】
: The rule says you can have default *value* such as N=100 in template class,
: but in template function you cannot do this.

1 (共1页)
进入Programming版参与讨论
相关主题
python 问题,急,在线等。C++ template function default argument 很怪?
js: 怎么来监听某个function被call的次数?one more interview question
如何定义 Javascript overload function ?Question: How to store initialize arguments?
matlab: how to set defaul value for function arguments来几个C++测试题
ajax小问题C里面有没有default argument这么一说,是不是只有在C++里有这个feature?
static如何作为函数?A simple question on Flex
interview questionsgdb里怎么call member function
问一个C++问题:default parameter and overriding/inheritanc (转载)[合集] Inline member function in C++
相关话题的讨论汇总
话题: template话题: default话题: class话题: templates话题: function