I'm discovering some C++11 features and have a problem. I have a member function 'call'
class cscript
{
public:
template <typename ret_t, typename... params>
bool call(ret_t &ret, const char * name, params... parameters);
....
Implementation:
template <typename ret_t, typename... params>
bool cscript::call(ret_t &ret, const char * name, params... parameters)
{
ret_t (*func)(params...);
func = (decltype(func)) tcc_get_symbol(tcc, name);
if (!func)
return true;
ret = func(parameters...);
return false;
}
When linking the following error is shown:
obj\Release\main.o:main.cpp:(.text.startup+0xcc)||undefined reference to `bool cscript::call<int, int, int>(int&, char const*, int, int)'|
Call example:
script.call(ret, "sum", 2, 3);
Any suggestions on how to make this work?