64,647
社区成员
发帖
与我相关
我的任务
分享
template <typename T, typename U>
struct IsConvertibleToType
{
// preparation
typedef char ConvertibleResultType;
struct UnconvertibleResultType
{
char m_internal[2];
};
// one of these functions is chosen depending on whether T is convertible to U
static ConvertibleResultType Test(U); //两个重名的对象?
static UnconvertibleResultType Test(...);//是不定数参数列表么?
static T MakeT();
// actual test
enum { Value = sizeof(Test(MakeT())) == sizeof(ConvertibleResultType) };
};
class T { T (); }; or struct T { T (int); };