The code below works for me. The trick is to use the typedef pointer function, not the typedef reference function. I am impressed that the compiler does not need all the parameters of the template, but it may possibly work out missing functions due to the overloaded type.
#include <tuple> #include <string> typedef std::tuple<int,std::string> Tuple; typedef std::string& (*PFun)(Tuple&); PFun p1=(PFun)std::get<1U>; PFun p2=(PFun)std::get<1U,int,std::string>;
In one line:
auto p3=(std::string& (*)(Tuple&))std::get<1U>;
Sorry to answer my own question. Sleeping at night can make a big difference.
source share