C syntax for functions returning function pointers

前端 未结 6 755
小蘑菇
小蘑菇 2020-12-02 04:49

Consider the following typedefs :

typedef int (*f1)(float);
typedef f1 (*f2)(double);
typedef f2 (*f3)(int);

f2 is a function

6条回答
  •  感动是毒
    2020-12-02 05:18

    Use std::function:

    typedef std::function f1;
    typedef std::function f2;
    typedef std::function    f3;
    

    or

    typedef std::function(double)>(int)> f3;
    

提交回复
热议问题