I have a function like below:
template<typename... Args>
int
error_handler (const char *format, Args&... args)
{
// deal with the information passed
}
I am writing a library that takes such a function pointer during init time, so the library can invoke this as a callback when something happens. However, I am not able to write such an API. I attempted the following but the compiler doesn't like it:
void init(template<typename... Args> int (*error_handler_cb)(const char *format, Args&... args));
Here is the error:
error: expected identifier before 'template'
void init(template<typename... Args> int (*error_logger_cb)(const char *format, Args&... args),
^~~~~~~~
libapi.hpp:20:22: error: expected ',' or '...' before 'template'
Can someone please help me to overcome this ?
Aucun commentaire:
Enregistrer un commentaire