Re: Getting FieldNameTuple including all base-classes.

2020-05-20 Thread drug via Digitalmars-d-learn
On 5/20/20 12:03 PM, realhet wrote: On Wednesday, 20 May 2020 at 01:18:24 UTC, Paul Backus wrote: On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote: I think what you want is `std.meta.staticMap`. Something like this: alias FieldNameTuple2(T) = staticMap!(FieldNameTuple,

Re: Getting FieldNameTuple including all base-classes.

2020-05-20 Thread realhet via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 09:03:51 UTC, realhet wrote: On Wednesday, 20 May 2020 at 01:18:24 UTC, Paul Backus wrote: On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote: With this mod it also works with structs: template AllClasses(T){ static if(is(T == class)) alias

Re: Getting FieldNameTuple including all base-classes.

2020-05-20 Thread realhet via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 01:18:24 UTC, Paul Backus wrote: On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote: I think what you want is `std.meta.staticMap`. Something like this: alias FieldNameTuple2(T) = staticMap!(FieldNameTuple, BaseClassesTuple!T); class A { int a, a1; } class

Re: Getting FieldNameTuple including all base-classes.

2020-05-19 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote: Hi, I was able to reach all the fields in a subclass using foreach and BaseClassesTuple, but is there a way to do this using functional programming primitives, but in compile time for tuples? private template FieldNameTuple2(T) {