template <typename T, typename V>
class is_customly_convertible {
typedef char one;
struct two { char x[2]; };
template <typename C> static one test(decltype(&C::operator()));
template <typename C> static two test(...);
public:
enum { val = sizeof(test<Convert<T, V>>(0)) == sizeof(char) };
};
class NoTriviallyConstruct {
public:
NoTriviallyConstruct() = delete;
};
class NoCopyConstruct {
public:
NoCopyConstruct(const NoCopyConstruct&) = delete;
NoCopyConstruct& operator=(const NoCopyConstruct&) = delete;
};
template<>
struct Convert<NoTriviallyConstruct, int> {
int operator()(const int &a) {
return a;
}
};
template<>
struct Convert<NoCopyConstruct, NoTriviallyConstruct> {
int operator()(const int &a) {
return a;
}
};