Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-04-12 01:28:24


Thorsten Ottosen wrote:

>> > won't boost::ref <> "solve" this. (don't bind use &?)
>>
>> No and no.
>
> (a)
> My comments about boost::bind comes from
> http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm
>
> But bind's reference docs seems to use by-value.

Looking at the code, it seems boost::bind uses non-const reference for
operator() -- the actual forwarding -- and by-value for arguments to 'bind'
itself.

So, you should add pass by non-const reference to the list of alternatives.
What I think about it is that const-reference prevents you from passing
non-const references to constructors of objects you put to container. OTOH,
with non-const references you'd break the passing of integer literals --
which is the point of the library.

Maybe, you really should support ref<> for passing non-const references.

- Volodya


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