Re: Can passing an address of this to a non-copyable object be made trusted? - i.e. can I disable moving?

2018-08-27 Thread aliak via Digitalmars-d-learn
On Monday, 27 August 2018 at 00:15:18 UTC, Jonathan M Davis wrote: On Sunday, August 26, 2018 5:10:29 PM MDT Nicholas Wilson via So, soon™? Bah humbug. Was afraid of this :p Yeah. Hopefully, we're able to disable moving at some point in the near future. However, right now, it's definitely

Re: Can passing an address of this to a non-copyable object be made trusted? - i.e. can I disable moving?

2018-08-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 26, 2018 5:10:29 PM MDT Nicholas Wilson via Digitalmars-d- learn wrote: > On Sunday, 26 August 2018 at 20:17:30 UTC, aliak wrote: > > So if we had this: > > > > struct A(T) { > > > > auto proxy() @trusted { > > > > return B!T(&this); > > > > } > > > > } > > > > struct B(T)

Re: Can passing an address of this to a non-copyable object be made trusted? - i.e. can I disable moving?

2018-08-26 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 26 August 2018 at 20:17:30 UTC, aliak wrote: So if we had this: struct A(T) { auto proxy() @trusted { return B!T(&this); } } struct B(T) { private A!T* source; private this(A!T* s) { source = s; } @disable this(); @disable this(this) {} @disable void opAssign(B!T);

Can passing an address of this to a non-copyable object be made trusted? - i.e. can I disable moving?

2018-08-26 Thread aliak via Digitalmars-d-learn
So if we had this: struct A(T) { auto proxy() @trusted { return B!T(&this); } } struct B(T) { private A!T* source; private this(A!T* s) { source = s; } @disable this(); @disable this(this) {} @disable void opAssign(B!T); } In order for f to be "safe" I need to ensure that B!