vendredi 11 août 2017

C++ Class member function pointer clarification

Example code:

class Type {
public:
    void Callback() { }
};

template <typename F> void Foo(F f) { }

void Boo() {
    Type obj;

    Foo(obj.Callback);    // Case A
    Foo(&Type::Callback); // Case B
}

Are there any meaningful differences between case A and B? When inspecting typename F it's resolved to the same type in both cases.

EDIT: I should mention I'm using GCC 5.0, the above code compiles fine.





Aucun commentaire:

Enregistrer un commentaire