Is there any way to deduce whether this function is a class static function according to the function name

48 Views Asked by At

I want to get the type of this function by function name, such as class static function, class non static member function, extern C function, etc. Can it be realized through Template Meta Programming or similar methods?

If I cannot do that at the compile time, is it possible at the run time? Thanks in advance.

extern "C" {
    void cFunction() { ... }
}

void normalFunction() { ... }

class MyClass
{
public:
    static void staticMemberFunction() { ... }
    void nonStaticMemberFunction() { ... }
};

// SOME_MACRO is what I want
SOME_MACRO(cFunction);  // print "C"
SOME_MACRO(normalFunction);  // print "normal"
SOME_MACRO(MyClass, staticMemberFunction);  // print "class static"
SOME_MACRO(MyClass, nonStaticMemberFunction);  // print "class non static"
0

There are 0 best solutions below