Boost logo

Boost Users :

Subject: Re: [Boost-users] What's wrong with my use of member-function bind?
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2011-07-28 04:28:08


On Thu, Jul 28, 2011 at 9:19 AM, 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?
>
>
Does

 subscribe (STATE1, bind(&S::bar, s1));

work?



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