模板参数居然也有默认值,小弟我刚才测试了一下, 对函数模板无效,咋整

模板参数居然也有默认值,我刚才测试了一下, 对函数模板无效,咋整?
拉登啊,你快来啊,刚学习的模板参数的默认值,居然就不通过:

template<class T,class V=int>
void show(T t,V v)
{
   cout<<t<<v;
}

居然编译出错,我昏迷。

------解决方案--------------------
引用:
我怎么没找到C++ 11上有这个规定?

因为你找的错地儿了。

c++03 14.1/9
A default template-argument is a template-argument (14.3) specified after = in a template-parameter. A default template-argument may be specified for any kind of template-parameter (type, non-type, template). A default template-argument may be specified in a class template declaration or a class template definition. A default template-argument shall not be specified in a function template declaration or a function template definition, nor in the template-parameter-list of the definition of a member of a class template. A default template-argument shall not be specified in a friend template declaration.

c++11 14.1/9
A default template-argument is a template-argument (14.3) specified after = in a template-parameter. A default template-argument may be specified for any kind of template-parameter (type, non-type, template) that is not a template parameter pack (14.5.3). A default template-argument may be specified in a template declaration. A default template-argument shall not be specified in the template-parameter-lists of the definition of a member of a class template that appears outside of the member’s class. A default template-argument shall not be specified in a friend class template declaration. If a friend function template declaration specifies a default template-argument, that declaration shall be a definition and shall be the only declaration of the function template in the translation unit.

新标准中已经取消了原标准中的限制(引文标红处)。