I\'m trying to write a template that behaves one way if T has a move constructor, and another way if T does not. I tried to look for a type trait that could identify this b
I took Aaron McDaid's last answer and wrapped it in the construct below. The code in his answer didn't work for me, this does with both clang 3.6 and MSVC2013.
template
struct has_move_constructor_alongside_copy {
typedef char yes[1];
typedef char no[2];
struct AmbiguousConverter {
operator T&& ();
operator const T& ();
};
template
static no& test(decltype( new C( AmbiguousConverter{} )));
template
static yes& test(...);
static const bool value = sizeof(test(0)) == sizeof(yes);
};