C syntax for functions returning function pointers

前端 未结 6 757
小蘑菇
小蘑菇 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:08

    In C++, the miracle of templates can make this a tad easier.

    #include 
    
    std::add_pointer<
        std::add_pointer<
            std::add_pointer<
                int(float)
            >::type(double)
        >::type(int)
    >::type wow;
    

提交回复
热议问题