Boost logo

Boost :

From: Lars Rune Nøstdal (larsnostdal_at_[hidden])
Date: 2004-06-16 07:55:12


On Wed, 16 Jun 2004 07:47:23 -0400, Jeff Flinn wrote:

>
> "Daniel Wallin" <dalwan01_at_[hidden]> wrote in message
> news:capatv$p48$1_at_sea.gmane.org...
> Lars Rune Nøstdal wrote:
>> void f(int x)
>> {
>> cout << "f(int): " << x << endl;
>> }
>>
>>
>> int x = 0;
>> bind(f, _1)(x);
>> //bind(f, _1)(1); // Does not work.
>> bind(f, _1)(val<int>(1)); // But this does after patching.
>>
>>
>> This enables the user to pass-by-value if he specifies it explicitly, here
> is the patch:
>
>
> Won't this work?
>
> bind(f,_1)( boost::cref(1) );
>
> Jeff Flinn
>

Uhm, yes it does. :)
Maybe the tutorial for bind should mention boost::cref in an example like that?

Lars Rune Nøstdal


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