Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-12 07:13:59


"David Abrahams" <dave_at_[hidden]> wrote in message
news:ufzb9ifv8.fsf_at_boost-consulting.com...
> "Thorsten Ottosen" <nesotto_at_[hidden]> writes:
>
> >> I don't have any opinion yet.
> >
> > I guess I didn't know that I was "misusing" bind(). Anyway, I find it
wrong
> > that
> > bind(foo,_1)(i) and bind(foo,i)() differs.
>
> Naturally it has to differ.
> bind(foo,i) needs to take a copy of i,
> or we wouldn't be able to do things like:
>
> int square(int);
>
> function<void(void)> f(int x)
> {
> return bind(square, x * 5);
> }

My point is that if the prototype was

void square( int& );

then

function< void(void) > f( int x )
{
   return bind( square, x*5 );
}

should not compile. It should only compile with a call to
ref().

br

Thorsten


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