mercredi 25 février 2015

std::function with variadic arguments, not templated variable arguments

I basically want to do the following:



typedef
std::function<int(const char* format, ...)> PrintfLikeFunction;


However, that does not seem to work.


Is that possible? I really need to match functions with variadic arguments in my case so that I could pass in printf.


The other reason is, I want to have



void doSomething(PrintfLikeFunction logger);


and the implementation should be separate, thus this must not be a template function.


Aucun commentaire:

Enregistrer un commentaire