|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-01-09 19:04:30
David Greene wrote:
> I'm trying to compile this little program:
>
> #include <boost/bind.hpp>
>
> #include <iostream>
>
> namespace tester {
> class Test {
> public:
> void do_test(void) { std::cout << "Done!" << std::endl; };
> };
> };
>
> int main(void)
> {
> tester::Test x;
>
> bind(&tester::Test::do_test, &x, _1)();
http://www.boost.org/libs/bind/bind.html#err_num_args
tester::Test::do_test takes one argument (the implicit 'this'), you are
passing two, &x and _1 (the first input argument).
In addition, although this is not relevant for this particular case,
http://www.boost.org/libs/bind/bind.html#err_arg_access
you are trying to access the first argument with _1 but no such argument
exists since you are calling the result of bind with (), i.e. zero
arguments.
Summary:
bind(&tester::Test::do_test, &x)();
or maybe
bind(&tester::Test::do_test, _1)( x );
> return(0);
> }
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net