
9 Dec
2006
9 Dec
'06
2:49 p.m.
Hervé Brönnimann wrote:
Peter: I tried
#include <boost/bind.hpp> void draw(int, int) {}
int main() { boost::bind<void>(&draw, _1, _2) (1, 2, 3, 4); return 0; }
and that didn't compile. How did you mean this: "Yes it can"?
Try one of 1. Using the above with CVS HEAD (you don't need the <void> and the &, but with works with them); 2. Passing lvalues: int main() { int a1 = 1, a2 = 2, a3 = 3, a4 = 4; boost::bind<void>(&draw, _1, _2) (a1, a2, a3, a4); } 3. A real scenario: int main() { boost::function< void( int, int, int, int ) > callback = boost::bind( draw, _1, _2 ); callback( 1, 2, 3, 4 ); }