【发布时间】:2013-08-08 19:03:23
【问题描述】:
考虑以下模板:
template<class T>
void doStuff(const T& a)
{
if(std::is_copy_assignable<T>::value)
{
T x;
x=a;
printf("Hello\n");
}
else
{
printf("Goodbye\n");
}
}
即使“Hello”部分从未针对不可复制分配的类型运行,也无法编译。我应该怎么做?
【问题讨论】:
标签: c++ templates metaprogramming typetraits