Boost logo

Boost :

From: Brian Braatz (brianb_at_[hidden])
Date: 2005-01-07 18:25:15


> -----Original Message-----
> Brian Braatz wrote:
> > With the following code, If you UNCOMMENT the "// public : Base"
line,
> > you get compiler errors (????)
> >
> > I have tested this with MS VC 7.1 against both 1.31 and 1.32
versions of
> > boost with the same results.
> >
> > Any idea why this is happening? (full sample code I wrote is
attached)
> >[snip]
> > std::string ReturnAString();
> > [snip]
> > bind(Base::ReturnAString,_1);

> [ Reece Wrote]
> This is the problem. Try:
> bind(Base::ReturnAString);
> or:
> bind(&Base::ReturnAString,this);
>

[Brian Braatz]
 THANK YOU BOTH REECE AND DANIEL :) (!!!!!!!!!!!!!!!)
That fixed it.

What is STRANGE is that "sometimes"
     bind(Base::ReturnAString) works

ironically, I have about 40 calls that use that syntax that work just
fine.

I noticed in the docs, when you have a inline functor, the docs use

> bind(Base::ReturnAString);

But when you have something that was not inline (??) you use:

> bind(&Base::ReturnAString);

I was never clear on when you and when you do NOT use the "&" with the
bind() syntax.....

I will convert everything in my "real code" to using the & always.

Question:
Does anyone know when you should and should not use the & in a bind
call? Or is this is compile time checking hole that exists due to the
mechanisms bind relies upon?

OR

Am I a complete idiot?

(I find it important to always hold open this option as a possibility in
everything)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk