|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-12 19:42:54
"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:000d01c420a3$e68d6240$1d00a8c0_at_pdimov2...
> Thorsten Ottosen wrote:
[snip]
> >> Why should it not compile?
> >
> > consider instead
> >
> > void write_to( string& s )
> > {
> > s += " foo";
> > }
> >
> > string s = "bar";
> > bind( write_to, s )();
> > cout << s; // won't print "bar foo"
>
> That's how bind works. All arguments in "bind(write_to, s)" are copied,
> including 'write_to'. If you make 'write_to' a stateful function object,
> "bind(write_to, s)()" won't update 'write_to' either.
But isn't it possible to reject compiling the above example? It's really not
what
I would expect people to expect, especially since bind(write,_1)(s) differs.
br
Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk