template class is_customly_convertible { typedef char one; struct two { char x[2]; }; template static one test(decltype(&C::operator())); template static two test(...); public: enum { value = sizeof(test>(0)) == sizeof(char) }; }; class NoTriviallyConstructible { public: NoTriviallyConstructible(int a, int b){ int c = a + b; } }; class NoCopyConstructible { public: NoCopyConstructible(const NoCopyConstructible&) = delete; NoCopyConstructible& operator=(const NoCopyConstructible&) = delete; }; template<> struct Convert { int operator()(const int &a) { return a; } }; template<> struct Convert { NoTriviallyConstructible operator()(const int &a) { return {1, 2}; } };