I think what you want is something like bind( &Controller::DoSomething, bind( &A::GetController, _1 ) );
That didn't work when I tried earlier, either because bind() produces a function instead of a pointer to a Controller or because GetController returns a reference instead of a pointer.
When binding member pointers, LL accepts either pointers or references as the object argument, and the above should thus work. This example works for me: #include "boost/lambda/bind.hpp" #include "boost/lambda/lambda.hpp" #include <iostream> using namespace boost; using namespace boost::lambda; class Controller { public: void DoSomething() { std::cout << "Hello World!"; }; }; class View { Controller& contr; public: View(Controller& c) : contr(c) {}; Controller& GetController() { return contr; } }; int main () { Controller c; View v(c); bind(&Controller::DoSomething, bind(&View::GetController, _1))(v); }; /Jaakko
Yahoo! Groups Sponsor ADVERTISEMENT
Info: http://www.boost.org Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
-- -- -- Jaakko Järvi email: jajarvi@cs.indiana.edu -- Post Doctoral Fellow phone: +1 (812) 855-3608 -- Pervasive Technology Labs fax: +1 (812) 855-4829 -- Indiana University, Bloomington