Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-08-15 20:51:25


"Thorsten Ottosen" <nesotto_at_[hidden]> writes:

> "David Abrahams" <dave_at_[hidden]> wrote in message news:uu0v5c248.fsf_at_boost-consulting.com...
> | "Thorsten Ottosen" <nesotto_at_[hidden]> writes:
>
> | > and to find an portable implementation of that (perhaps without a
> | > using declaration).
> |
> | Should be no trouble, I think. That said, I think you were on the
> | right track to a solution.
>
> yeah maybe. I'm kinda running out of time to do too much experimenting right now.
>
> | Before we declare victory we should probably discuss the issue of
> | handling lvalue/rvalue arguments to the function that's ultimately
> | called.
>
> sure. Can you explain the issue?

The scheme forwards all overloads through a central function, rather
than calling them directly. Naive forwarding schemes are prone to
"erasing rvalueness", because function parameters are lvalues. You
can also easily and mistakenly prevent rvalues from being passed by
taking only T& parameters. We could try to force rvalues through a
different overload of the outer function and use an identity function
inside it to recreate rvalue-ness, but I think it's impossible in
general and it doesn't seem to be worth it anyway.

-- 
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