Re: why @property cannot be pass as ref ?

2018-01-03 Thread ChangLong via Digitalmars-d-learn
On Wednesday, 3 January 2018 at 08:51:55 UTC, Simen Kjærås wrote: On Saturday, 30 December 2017 at 03:49:37 UTC, ChangLong wrote: What I am try to do is implement a unique data type. (the ownership auto moved into new handle) Have you considered std.typecons.Unique[0]? If yes, in what ways

Re: why @property cannot be pass as ref ?

2018-01-03 Thread Simen Kjærås via Digitalmars-d-learn
On Saturday, 30 December 2017 at 03:49:37 UTC, ChangLong wrote: What I am try to do is implement a unique data type. (the ownership auto moved into new handle) Have you considered std.typecons.Unique[0]? If yes, in what ways does it not cover your needs? Your example code written with

Re: why @property cannot be pass as ref ?

2018-01-02 Thread Ali Çehreli via Digitalmars-d-learn
On 12/29/2017 07:49 PM, ChangLong wrote: On Wednesday, 20 December 2017 at 18:43:21 UTC, Ali Çehreli wrote: Thanks to Mengü for linking to that section. I have to make corrections below. Ali Thanks for explain, Ali And Mengu. What I am try to do is implement a unique data type. (the

Re: why @property cannot be pass as ref ?

2017-12-29 Thread ChangLong via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 18:43:21 UTC, Ali Çehreli wrote: Thanks to Mengü for linking to that section. I have to make corrections below. Ali Thanks for explain, Ali And Mengu. What I am try to do is implement a unique data type. (the ownership auto moved into new handle)

Re: why @property cannot be pass as ref ?

2017-12-20 Thread Ali Çehreli via Digitalmars-d-learn
Thanks to Mengü for linking to that section. I have to make corrections below. On 12/20/2017 10:04 AM, Ali Çehreli wrote: > 'auto ref' essentially generates two copies of the function: one taking > by-value for rvalues Note that by-value for rvalues means "blitting" in D (blit: bit-level

Re: why @property cannot be pass as ref ?

2017-12-20 Thread Mengu via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 18:04:57 UTC, Ali Çehreli wrote: On 12/20/2017 07:02 AM, ChangLong wrote: > [...] is not > [...] The problem is not with opAssign but with left(), which returns an rvalue. It's by design that rvalues cannot be bound to references in D. [...] was just

Re: why @property cannot be pass as ref ?

2017-12-20 Thread Ali Çehreli via Digitalmars-d-learn
On 12/20/2017 07:02 AM, ChangLong wrote: > === > struct A { > alias This= typeof(this) ; > > void opAssign(ref This ){ > } > > ref auto left(){ > return This() ; > } > } > > void main(){ > Aroot ; > ref find() { >

why @property cannot be pass as ref ?

2017-12-20 Thread ChangLong via Digitalmars-d-learn
=== struct A { alias This = typeof(this) ; void opAssign(ref This ){ } ref auto left(){ return This() ; } } void main(){ A root ;