[英]How do I fully specialize a function template with a class template?
template <typename T>
void foo(T t)
{
... // do stuff with type T
}
template <typename T>
class class_template
{
// class body
};
template<> // failed attempt at full specialization
void foo(class_template<T> t) // which doesn't work of course
{
//full specialization for all classes of class_template
}
在上面的代碼中,如何使用類模板顯式地專門化foo函數?
在上面的代碼中,如何使用類模板顯式地專門化foo函數?
你不能。 這是部分專業的重點。 但是它們不適用於功能。
您有兩種解決方案:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.