// explicit_specialization.cpp
template<class T> void f(T t)
{
};
// Explicit specialization of f with 'char' with the
// template argument explicitly specified:
//
template<> void f<char>(char c)
{
}
// Explicit specialization of f with 'double' with the
// template argument deduced:
//
template<> void f(double d)
{
}
int main()
{
}
本文通过一个C++代码示例介绍了如何进行显式模板特化,包括使用字符和双精度浮点数作为模板参数的具体实现方式。
607

被折叠的 条评论
为什么被折叠?



