Boost logo

Boost Users :

From: David Greene (greened_at_[hidden])
Date: 2006-01-10 10:44:29


Peter Dimov wrote:
> 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).

Aha! Ok, so it was a fundamental misunderstanding of the bind mechanism
itself. For some reason I had it in my head that _1 indicated which
argument that &x should be bound to.

                          -Dave


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