#include
#include
#include
using M3Result = const char*;
namespace cc {
template
struct m3_sig {
static const char value = c;
};
template struct m3_type_to_sig;
template<> struct m3_type_to_sig : m3_sig<'i'> {};
template<> struct m3_type_to_sig : m3_sig<'I'> {};
template<> struct m3_type_to_sig : m3_sig<'f'> {};
template<> struct m3_type_to_sig : m3_sig<'F'> {};
template<> struct m3_type_to_sig : m3_sig<'v'> {};
template<> struct m3_type_to_sig : m3_sig<'*'> {};
template<> struct m3_type_to_sig : m3_sig<'*'> {};
template
struct m3_signature {
constexpr static size_t n_args = sizeof...(Args);
constexpr static const char value[sizeof...(Args) + 4]
= {
m3_type_to_sig::value,
'(',
m3_type_to_sig::value...,
')',
0
};
};
template
constexpr const char m3_signature::value[sizeof...(Args) + 4];
}
template
class Wrapper;
template
class Wrapper {
public:
static M3Result link() {
return cc::m3_signature::value;
}
};
class Module {
public:
template
M3Result link(Func *function) {
M3Result ret = Wrapper::link();
return ret;
}
};
void* Test(int, float) {
return 0;
}
int main() {
Module m;
std::cout << m.link(Test) << std::endl; // *(if)
return 0;
}