C++ detect any constructor with SFINAE

Viewed 178

I tried to create a template class that should detect any constructor by using SFINAE and variadic templates. Here is code of the template:

template <typename Type, typename ... Arguments>
struct IsConstructible
    {

        template <typename U, decltype(U(Arguments...))* = nullptr>
        static char test();
        template <typename U>
        static long test(...);

        static constexpr bool value = sizeof(test<Type>()) == sizeof(char);

    };

However, when I test this with following type:

struct MyBadType {

    MyBadType(int x) { }

};

the result of this:

IsConstructible<MyBadType, int>::value;

is 0. Is there anything wrong with my template checker? I am using MSVS 2015 express.

1 Answers
Related