does cast make an lvalue appear to be an rvalue

Daniel Davidson nospam at spam.com
Wed Oct 16 11:14:21 PDT 2013


On Wednesday, 16 October 2013 at 17:58:41 UTC, Dicebot wrote:
> On Wednesday, 16 October 2013 at 17:50:48 UTC, Daniel Davidson 
> wrote:
>> On Wednesday, 16 October 2013 at 17:16:39 UTC, Dicebot wrote:
>>>
>>> It works as it should. Make a mutable copy of t2 and pass it. 
>>> Or make foo() accept const. I can't imagine a single 
>>> legitimate use case for destroying type system in a way you 
>>> want.
>>
>> How do you propose to make a mutable copy *generically*?
>
> Recursively going through the levels of indirection via static 
> introspection and allocating memory for new mutable 
> counter-parts as it goes. Maybe it should belong to Phobos, no 
> idea right now, will know once I ever find the need for it.

I agree with the sentiment. But as it stands I think a copy 
should not be necessary. I could make a local mutable R, pass it 
to createRFromT to get it initialized and then copy it back 
somehow to the member variable r. That to me is silly. The copy 
should not be required.


More information about the Digitalmars-d-learn mailing list