Interior immutability and rvalues

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 15 08:14:24 PDT 2016


On 07/15/2016 02:51 PM, maik klein wrote:
> Thanks I didn't know that you could have type qualifiers inside
> templates, D still surprises me sometimes.

Qualifiers are part of the type. So wherever you can have a type, you 
can have a qualified type.

> I don't think it is practical to call move on "everything", for example
> maybe you just want to pass a `ref` or a `class`.

Does move do something bad with class references? I would expect it to 
just copy the reference, maybe null the original.

I'm not sure what you mean by passing a ref. ref is specified in the 
signature of the called function. So it depends on someOtherTest if the 
argument is passed by ref, and you have to check that if you don't know 
the signature beforehand. But it doesn't matter if the variable is 
copyable or not.


More information about the Digitalmars-d-learn mailing list