【发布时间】:2017-10-29 00:09:15
【问题描述】:
我想检查是否存在某个模板专业化,其中未定义一般情况。
给定:
template <typename T> struct A; // general definition not defined
template <> struct A<int> {}; // specialization defined for int
我想定义一个这样的结构:
template <typename T>
struct IsDefined
{
static const bool value = ???; // true if A<T> exist, false if it does not
};
有没有办法做到这一点(最好不用 C++11)?
谢谢
【问题讨论】:
-
为什么需要这样做?出于好奇而询问。
-
@HSchmale,这里描述了完整的问题:stackoverflow.com/questions/44237528/…
标签: c++ templates template-specialization sfinae