, :
void(*pFunc)(WHAT_TO_TYPE_HERE?) = &Factory::testFunc;
pFunc(10, false, 'a', 11.5);
WHAT_TO_TYPE_HERE
void(*pFunc)(int&&, bool&&, char&&, double&&) = &Factory::testFunc;
pFunc(10, false, 'a', 11.5);
, rvalue/lvalue , .
, :
template<class Sig, class Function>
struct testfunc_as_function_ptr;
template<class R, class...Args>
struct testfunc_as_function_ptr {
R(*)(Args...) operator()() const {
return [](Args...args){ return Factory::testFunc(std::forward<Args>(args)...); };
}
};
, :
void(*pFunc)(int,bool,char,double) = testfunc_as_function_ptr<void(int, bool, char, double)>{}();
, testFunc, .
, , ENTIRE template, :
.
, , , "" ++. . template - - .
. .
, template<class...Args> void testFunc(Args&& ...args) . , - , , . "" .
, , , (, , , , - , ).
( ) , "" ( ). .
void testFunc(...) . , . , void testFunc(...).
, , (), . , , , , , .
, , , .
++ . (), .
, , Args.... , , , Arg ?
, :
struct printable { virtual std::string to_string() const = 0; ~printable(); };
using printer = void(*)(std::vector<std::unique_ptr<printable>>);
printer - , vector printable. , T printable.
, , , Args....
, , - boost::any, , . void (*)(...) C-style variardic, -, , .