Skip to content

Instantly share code, notes, and snippets.

Created December 9, 2019 18:36
What would you like to do?
use C++ member functions as callbacks
#include <functional>
#include <iostream>
using namespace std;
class C
int foo;
void m()
cout << foo << endl;
void g(std::function<void()> f)
int main()
C c; = 123;
g(std::bind(&C::m, &c));
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment