I've been attempting a little SFINAE at making a way to determine if a generic type T has a copy constructor I can use. Here is where I currently am.
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(...)
{}
};
However, this is also where I'm kinda stuck. &T::T(const T&)
is obviously an invalid statement, as we can't provide an argument list with a pointer-to-member, even if a p-t-m-function.
I could always try to specify some sort of void (T::*ptmf)(const T&) = &T::T
, and hope it implicitly determines the right overloaded constructor to put into the pointer to member function, but that also implies that Constructors have a specific return type, which I would have to specify.
Does anyone else have any ideas with which I can trek forth? (I also need to apply a similar concept to checking for an assignment operator.)
Thanks in advanced.