Can you move a disabled this(this) struct in to a container type if it's an rvalue?
aliak
something at something.com
Sat Dec 15 09:35:15 UTC 2018
On Thursday, 13 December 2018 at 23:33:39 UTC, Stanislav Blinov
wrote:
> On Thursday, 13 December 2018 at 13:17:05 UTC, aliak wrote:
>
>> [...]
>
> Hypothetically, yes, e.g. an object that contains references to
> itself. However, D operates on the assumption that you don't
> have such objects. And even though it can't be statically
> checked, move and swap do actually perform this check at
> runtime in debug builds.
> Operating under that rule, it should be legal to move any
> values that are passed to you. In fact, I postulate that it
> *must* be done instead of making copies. Unfortunately, Phobos
> doesn't agree.
>
> [...]
Oh cool! An isRef trait. TIL!
And I see, thank you all for the tips!
More information about the Digitalmars-d-learn
mailing list