#include #define BOOST_CLOSURE_MAX_ARITY 5 #include "closure.hpp" #include namespace boost { template inline typename closure::return_type operator->*(shared_ptr& sp, U ptr) { return make_closure(sp.get(), ptr); } } // boost struct X { int x, y; inline X() : x(0), y(0) { return; } void set(int x, int y) { this->x = x; this->y = y; return; } }; int main(void) { boost::shared_ptr px(new X); typedef void (X::* pset_t)(int, int); pset_t pf = &X::set; (px->*pf)(2, 3); typedef int X::* xy_t; xy_t p1 = &X::x, p2 = &X::y; std::cout << px->*p1 << ' ' << px->*p2 << &std::endl; return 0; }