#pragma once
struct NoTriviallyConstructible {
public:
NoTriviallyConstructible() = delete;
};
struct NoCopyConstructible {
public:
NoCopyConstructible(const NoCopyConstructible&) = delete;
NoCopyConstructible& operator=(const NoCopyConstructible&) = delete;
};
template <>
struct Convert<NoTriviallyConstructible, int> {
int operator()(const int& a) {
return a;
}
};
template <>
struct Convert<NoCopyConstructible, NoTriviallyConstructible> {
int operator()(const int& a) {
return a;
}
};
template<typename T, typename Ti>
struct is_customly_convertible {
template<typename T1>
static void detect(...);
template<typename T1>
static decltype(T1().operator()(0))
detect(decltype(&T1::operator()));
template<typename T1>
static decltype(T1().operator()({0, 0}))
detect(decltype(&T1::operator()));
static constexpr bool value = !std::is_same<void,
decltype(detect<Convert<T, Ti>>(0))>::value;
};