Default template arguments for function templates
Posted
by Arman
on Stack Overflow
See other posts from Stack Overflow
or by Arman
Published on 2010-03-15T13:36:02Z
Indexed on
2010/03/15
14:49 UTC
Read the original article
Hit count: 461
Why are default template arguments only allowed on class templates? Why can't we define a default type in a member function template? For example:
struct mycclass {
template<class T=int>
void mymember(T* vec) {
// ...
}
};
Instead, C++ forces that default template arguments are only allowed on a class template.
© Stack Overflow or respective owner