Boost logo

Boost :

Subject: Re: [boost] Library design Q : overloads v/s default args
From: David Abrahams (dave_at_[hidden])
Date: 2010-06-20 11:32:50


At Sun, 20 Jun 2010 11:18:13 -0400,
Eric Niebler wrote:
>
> On 6/20/2010 11:00 AM, David Abrahams wrote:
> > At Sun, 20 Jun 2010 16:21:14 +0200, Thomas Klimpel wrote:
> >
> >> [1] It's not really about "perfect forwarding", but about capturing
> >> the non-const rvalue references. This is required for handling calls
> >> using adapters like "lapack::syev(bindings::lower(A), w);".
> >
> > I'm just curious, Have you thought about using const rvalues as return
> > types in these situations? If you consider the adapter itself to be
> > immutable and the target sequence to be a separate object (which in
> > reality it is), it actually all makes sense. And a T const return
> > type will bind nicely to a generalized U& argument.
>
> Interesting to hear you recommending this practice. I use it extensively
> in Proto but have felt like a bad citizen for doing it because I've
> heard that practice proscribed by various experts and committee members.

To heck with the “experts!” I remember discussing that possibility
with you years ago, so you shoulnd't be surprised :-) I think at the
time you were leery because you also wanted your code to work with
3rd-party functions that return non-const rvalues.

loving-playing-the-populist-demagogue-ly y'rs,

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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