Boost logo

Boost Users :

Subject: Re: [Boost-users] What's wrong with my use of member-function bind?
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2011-07-28 04:27:58


On Thu, 28 Jul 2011 01:19:11 -0700, John M. Dlugosz
<mpbecey7gu_at_[hidden]> wrote:

> On 7/27/2011 3:35 PM, Igor R wrote:
>>> My compiler crashes when I write:
>>>
>>> bind(&S::bar,&s1);
>>>
>>> is there some known issue with VS8?
>>
>> Yes, VC8 crashes on incorrect bind expressions.
>> You probably missed some placeholder.
>
> Thanks. Can someone tell me what's wrong? I thought I followed the
> example from the manual.
>
>
> void foo (int);
>
>
> class S {
> const char* const name;
> public:
> S(const char* x) : name(x) {}
> void bar (int);
> };
>
>
>
> S s1 ("s1"); // some instance
>
> void subscribe (State_t st, const NotifyFunc& func);
>
> subscribe (STATE1, &foo); // this works, so the form of the function
> parameters is right.
>
> subscribe (STATE1, bind(&S::bar, &s1)); // this one is wrong. Why?

What's NotifyFunc defined as?
What's STATE1 defined as?


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