I want to pass std::function
as a callback parameter to another function.
The function to be bound is a static function with variable argument list.
The static function is as follows:
void abc::static_func(const char* const text,...);
abc
is a static class and static_func
is a static function.
The function where std::function
parameter to be received:
void xyz(std::function<void(const CHAR* const text, ...)> arg);
I tried following:
std::function<void(const CHAR* const text, ...)> callback = std::bind(void(*)(const CHAR* const text, ...))(&abc::func);
I do not want to add auto as callback has to be passed to xyz function further.
I have looked up over online and I got a variadic template related answers but they do not fit into the above problem and mostly auto is used in all the answers.
Any suggestions/help would be much appreciated.