Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-14 14:40:25


AMDG

gfsdjkgf_at_[hidden] wrote:
> Hello,
> let's come straight to the code. I am not sure why it fails (both boost::bind and boost::lambda::bind fail). I use Visual Studio 9 (2008, x86) and boost 1.35 (retail).
> What's wrong?
>
> #include <boost/bind.hpp>
> using boost::bind;
>
> //#include <boost/lambda/bind.hpp>
> //using boost::lambda;
>
> template<class Handler_t>void Test2(Handler_t Handler)
> {
> }
>
> template<class Handler_t>void Test1(Handler_t Handler)
> {
> bind(&Test2<Handler_t>, Handler)();
>

Wrap Handler in boost::protect. For lambda use boost::lambda::protect

bind(&Test2<Handler_t>, boost::protect(Handler))();

> }
>
> void TestFunc(int i)
> {
> }
>
> int main()
> {
> Test1(bind(TestFunc,0));
> }
>

In Christ,
Steven Watanabe


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