Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2004-09-16 21:34:36

David Abrahams wrote:

> "Neal D. Becker" <nbecker_at_[hidden]> writes:
>> 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.
> The problem with that is that casting away the const on a const rvalue
> is sometimes unsafe. See the original move semantics proposal for
> details.

Not sure what you're saying here. I agree it can sometimes be unsafe.
That's why you shouldn't use it - except when you really want to. Isn't
that consistent with the move semantics proposal?

The main use I had in mind, is when you want:

void F (T1 in, T2 &out) { write to out }
F (something, make_temp())

Where you don't really care that F is going to write to the temporary, it's
really not used. Other approaches are possible here, e.g., boost::optional
- but this was intended for the case where F was already written to a
certain interface.

Boost list run by bdawes at, gregod at, cpdaniel at, john at