简体   繁体   English

在C ++中,为什么模板函数不能具有部分专业化?

[英]In C++, why template function cannot have partial specialization?

Why C++ has this restriction, in other words, if template function could also be partially-specialized, does it lead to any ambiguity or implementation complexity? 为什么C ++会有这个限制,换句话说,如果模板功能也可以被部分专业化,它会导致任何歧义或实现复杂性吗?

Why it cannot act like template class? 为什么它不能像模板类一样工作?

我相信这样的想法是,您可以通过重载函数模板来覆盖大多数情况(某些类无法做到),而设计人员可能认为剩余的情况不值得在重载解析中增加其他复杂性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM