Pass 'this' as reference
Adam D. Ruppe
destructionator at gmail.com
Wed Sep 12 15:05:41 UTC 2018
On Wednesday, 12 September 2018 at 15:01:36 UTC, Jan wrote:
> I'm using D not for that long and lately I have encountered an
> issue. I have class 'Foo' with a constructor using this
> signature:
> `this (ref Bar original)`
classes and the ref keyword should very rarely be used together
in D. classes are already refs without anything, so adding it
makes it a double ref, which breaks more than it helps.
If you just get rid of the `ref`s in your code it will probably
work.
More information about the Digitalmars-d-learn
mailing list