Binding rvalues to ref parameters redux
bitwise
bitwise.pvt at gmail.com
Tue Apr 2 17:56:47 UTC 2019
On Monday, 1 April 2019 at 20:17:33 UTC, Timon Gehr wrote:
> On 01.04.19 18:43, bitwise wrote:
>
>> If I had to have my rvalues qualified with const, that would
>> be fine. To be honest, I don't think I've written any C/C++
>> code that casts const away in years, ...
>
> There is no D const in C++.
I meant that if you had a C function that returned a const
object, you could use D's const in the extern(C) D function
declaration. If you did that, you could safely cast const away
from the returned object knowing that it wasn't some immutable
data in D hiding underneath. Aside from this case, I would
consider it unnecessary, and in most cases unacceptable, to cast
const away.
>> ... > As far as using const, I don't really think it's that
>> bad.
>>
> Yes, it really is that bad.
Can you provide an example?
Thanks!
More information about the Digitalmars-d
mailing list