64,636
社区成员
发帖
与我相关
我的任务
分享
template <class T2>
struct Goo
{
void goo(T2 v)
{
}
};
template <class T1, class T2>
struct Foo : Goo<T2>
{
void foo(T1 v)
{
}
};
template <class T2>
struct Foo<int, T2> : Goo<T2>
{
void foo(int v)
{
}
};
#include <stdio.h>
template <class T>
void print(T v)
{
puts("Huh?");
}
template <>
void print<int>(int v)
{
printf("%d\n", v);
}
template <>
void print<float>(float v)
{
printf("%f\n", v);
}
int main()
{
print(1);
print(1.0f);
print(1.0);
}