|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-05-07 11:08:30
Douglas Gregor <gregod_at_[hidden]> writes:
> On Friday 07 May 2004 10:30 am, Dill, John wrote:
>> I see your point. But, what if instead of argument_traits being pass by
>> value, it by default passes by T const&? What could be done is to have the
>> bind_t arguments be passed by const reference, and then use
>> reference_wrapper to do type-selection to pass by reference. It still
>> supports literals, and passes by T const& when it can, but everything that
>> is passed by reference must have a ref( object ). The compiler would fail
>> if you try to pass a reference without a reference_wrapper because it by
>> default tries to pass a T const&. This wouldn't require the 2^N overloads
>> but would require you to do a ref( object ) for everything passed by
>> reference. This might also be a workaround for those compilers that don't
>> support T& and T const& overloading.
>
> So we'd be trading lvalue support for literal support. In my experience,
> lvalues are _much_ more important than literals[*],
It's literals and rvalues. Not that I support the proposed trade, but I
should point out that rvalues are important, especially for function
composition.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk