Boost logo

Boost Users :

Subject: [Boost-users] [bind] Binding a bound function does not compile
From: Eugene Yakubovich (eyakubovich_at_[hidden])
Date: 2009-11-17 13:03:43


Hello,

The following code does not compile (gcc 4.3.2, boost 1.40).

#include <boost/bind.hpp>
using boost::bind;

void foo(int) {}

template <class F>
void invoker(F f) { f(); }

template <class F>
void call(F f)
{
    bind(invoker<F>, f)();
}

int main(int argc, char* argv[])
{
    call(bind(foo, 1));

    return 0;
}

I am passing a bound function as an argument to bind. The binding itself seems to work but the call fails. In other words, if I change the line in call() to

bind(invoker<F>, f);

it compiles just fine.

Any ideas?

Thanks,
Eugene

This e-mail and its attachments are intended only for the individual or entity to whom it is addressed and may contain information that is confidential, privileged, inside information, or subject to other restrictions on use or disclosure. Any unauthorized use, dissemination or copying of this transmission or the information in it is prohibited and may be unlawful. If you have received this transmission in error, please notify the sender immediately by return e-mail, and permanently delete or destroy this e-mail, any attachments, and all copies (digital or paper). Unless expressly stated in this e-mail, nothing in this message should be construed as a digital or electronic signature.


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