Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-09-15 14:37:57


Daniel Wallin wrote:

> Neal D. Becker wrote:
>
>> This handy little item, lvalue_cast, would make a useful addition to
>> boost. I didn't write it, and I don't recall who did.
>>
>>
>>
>> template<class T>
>> inline T& lvalue_cast (const T& rvalue) {
>> return const_cast<T&> (rvalue);
>> }
>
>
> I wrote something like this, that has the upshot of being safe. ;)
>
> http://article.gmane.org/gmane.comp.lib.boost.devel/101531
>

The trick would be to get it to return a const lvalue when you pass a
const rvalue ;-)

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