Boost logo

Boost :

From: Dill, John (john-dill_at_[hidden])
Date: 2004-05-07 09:54:35


"Douglas Gregor" <gregod_at_[hidden]> wrote in message news:<200405071039.24725.gregod_at_[hidden]>...
> 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[*], and we've had these
> semantics for a really long time (they'll be part of the C++ Library TR), so
> it will take a truly killer argument to change this.
>
> [*] Thinking of my own work, where I use lots of bind expressions, I remember
> only once having to name a temporary to get around the T& issue with bind,
> but can thinking of at least 4 places where I pass lvalues through bind.

Okay, just trying an idea out. Thanks for your comments.

John


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