Re: Best way to refer to the type of a struct inside itself ?

2020-05-15 Thread wjoe via Digitalmars-d-learn
On Friday, 15 May 2020 at 15:24:32 UTC, Ali Çehreli wrote: On 5/15/20 8:04 AM, Paul Backus wrote: [...] Yes, that is a consistent way of explaining it. :) As an off-topic trivia, the same feature is in C++ as well: [...] Ali Awesome. Thank you Ali and Paul :)

Re: Best way to refer to the type of a struct inside itself ?

2020-05-15 Thread Ali Çehreli via Digitalmars-d-learn
On 5/15/20 8:04 AM, Paul Backus wrote: On Friday, 15 May 2020 at 14:55:07 UTC, Ali Çehreli wrote: Additionally, the name of a template when used inside that template means that instance of it. So just say Foo. :) struct Foo(A, B, C, size_t a, size_t b) {   Foo * p; } Ali To expand a

Re: Best way to refer to the type of a struct inside itself ?

2020-05-15 Thread Paul Backus via Digitalmars-d-learn
On Friday, 15 May 2020 at 14:55:07 UTC, Ali Çehreli wrote: Additionally, the name of a template when used inside that template means that instance of it. So just say Foo. :) struct Foo(A, B, C, size_t a, size_t b) { Foo * p; } Ali To expand a little, this works because a struct template

Re: Best way to refer to the type of a struct inside itself ?

2020-05-15 Thread Ali Çehreli via Digitalmars-d-learn
On 5/15/20 7:37 AM, wjoe wrote: On Friday, 15 May 2020 at 13:52:38 UTC, Paul Backus wrote: On Friday, 15 May 2020 at 13:47:43 UTC, wjoe wrote: struct Foo(A, B, C, size_t a, size_t b) {   alias foo_t = Foo!(A, B, C, a, b); // is there a better way to get foo_t ? } typeof(this) Thanks :)

Re: Best way to refer to the type of a struct inside itself ?

2020-05-15 Thread wjoe via Digitalmars-d-learn
On Friday, 15 May 2020 at 13:52:38 UTC, Paul Backus wrote: On Friday, 15 May 2020 at 13:47:43 UTC, wjoe wrote: struct Foo(A, B, C, size_t a, size_t b) { alias foo_t = Foo!(A, B, C, a, b); // is there a better way to get foo_t ? } typeof(this) Thanks :)

Re: Best way to refer to the type of a struct inside itself ?

2020-05-15 Thread Paul Backus via Digitalmars-d-learn
On Friday, 15 May 2020 at 13:47:43 UTC, wjoe wrote: struct Foo(A, B, C, size_t a, size_t b) { alias foo_t = Foo!(A, B, C, a, b); // is there a better way to get foo_t ? } typeof(this)

Best way to refer to the type of a struct inside itself ?

2020-05-15 Thread wjoe via Digitalmars-d-learn
struct Foo(A, B, C, size_t a, size_t b) { alias foo_t = Foo!(A, B, C, a, b); // is there a better way to get foo_t ? }