how to use std::function to point to a function template

后端 未结 4 989
野性不改
野性不改 2021-02-04 01:29
#include 

int func(int x, int y)
{
    return x+y;
}

int main()
{
    typedef std::function Funcp;
    Funcp funcp = func;

             


        
4条回答
  •  野的像风
    2021-02-04 01:55

    No. A template function is exactly that, a template. It's not a real function. You can point a std::function to a specific instantiation of the template function, e.g. func

提交回复
热议问题