检查类是否具有TMP的复制构造函数

Ser*_*rge 2 c++ sfinae pointer-to-member template-meta-programming

我一直在尝试一点SFINAE来确定泛型类型T是否有我可以使用的复制构造函数.这是我现在的位置.

template <bool statement, typename out>
struct Failable
{
    typedef out Type;
};
//This class is only used to insert statements that 
//could encounter substitution failure


template <typename O>
struct COPY
{
    template <typename T>
    typename Failable<true == sizeof(&T::T(const T&)), char>::Type copy(int)
    {}

    template <typename T>
    typename Failable<true, int>::Type copy(...)
    {}

};
Run Code Online (Sandbox Code Playgroud)

然而,这也是我有点卡住的地方. &T::T(const T&)显然是一个无效的语句,因为我们不能提供带有指向成员的参数列表,即使是ptm函数也是如此.我总是可以尝试指定某种类型void (T::*ptmf)(const T&) = &T::T,并希望它隐式确定正确的重载构造函数放入指向成员函数的指针,但这也意味着构造函数具有特定的返回类型,我必须指定.

有没有其他人有任何我可以跋涉的想法?(我还需要应用类似的概念来检查赋值运算符.)

提前致谢.