【发布时间】:2012-07-02 20:55:34
【问题描述】:
我想知道如果模板参数之一属于某种类型,是否可以部分专门化模板化方法的行为。
template<class T>
void Foo(T& parameter)
{
/* some generic - all types - stuff */
If(T is int) // this is pseudo-code, typeinfo? Boost?
{
/* some specific int processing which might not compile with other types */
}
/* again some common stuff */
}
欢迎提出任何建议。 谢谢
【问题讨论】:
-
我编辑了标题,因为“部分专业化”一词的含义与此处所问的完全不同。
标签: c++ templates boost runtime compile-time