Re: [Boost-users] bosst::bind problem
Hi Oleg! your function Handler::Test2 takes 2 arguments + this. But your code passes 3 arguments + this to the function boost::bind(&Handler::Test2, _1, _2, a, b)). If I'm not completely mistaken that cannot work. What did you expect the _2 to be in this case?. Using the _2 also implies that the resulting function of the bind expects 2 arguments. That is you cannot simply use it with for_each in that kind of way. This supplies only one parameter. kind regards Alex
-----Ursprüngliche Nachricht----- Von: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org]Im Auftrag von Oleg Smolsky Gesendet: Donnerstag, 28. Juli 2005 03:22 An: boost-users@lists.boost.org Betreff: [Boost-users] bosst::bind problem
Hi all,
I've just started using boost::bind and found the following problem:
class Handler { public: bool Test1(std::string sComponent); bool Test2(std::string sComponent, std::string sAddress); };
void Test() { std::vector<Handler> v;
// This compiles std::string a, b; std::for_each(v.begin(), v.end(), boost::bind(&Handler::Test1, _1, a));
// This doesn't compile //std::for_each(v.begin(), v.end(), // boost::bind(&Handler::Test2, _1, _2, a, b)); }
Environment: boost 1.32, VC8, WinXP.
Any ideas?
Thanks, Oleg.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (1)
-
Jasper, Alexander