Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

What does this C++ code do?

Can you please explain what this code is supposed to do? Thanks.

template <typename T> void f( T & t, void ( T::*x )() ) {

    (t.*x)();

}

struct A {

    void f() {}

};

int main() {

    A a;

    f( a, &A::f );

}

1 Answer

Relevance
  • Anonymous
    9 years ago
    Favorite Answer

    Uses the template to make a new structure.

Still have questions? Get your answers by asking now.