Re: CT Inheritence structures

2016-08-20 Thread Engine Machine via Digitalmars-d-learn
On Saturday, 20 August 2016 at 06:28:47 UTC, Enamex wrote: On Saturday, 20 August 2016 at 00:46:15 UTC, Engine Machine wrote: I am trying to get Timon Gehr's code working, with some modifications: void main() { import std.traits; auto a = new Type!("Animal", "Dog", "Pug")();

Re: CT Inheritence structures

2016-08-20 Thread Engine Machine via Digitalmars-d-learn
On Saturday, 20 August 2016 at 09:42:08 UTC, Jack Applegame wrote: On Saturday, 20 August 2016 at 00:46:15 UTC, Engine Machine wrote: Any ideas? Something like this? mixin template TypeData(string type: "Animal") { int y; } mixin template TypeData(string type: "Dog") { int z; } mixin t

Re: CT Inheritence structures

2016-08-20 Thread Jack Applegame via Digitalmars-d-learn
On Saturday, 20 August 2016 at 00:46:15 UTC, Engine Machine wrote: Any ideas? Something like this? mixin template TypeData(string type: "Animal") { int y; } mixin template TypeData(string type: "Dog") { int z; } mixin template TypeData(string type: "Pug") { int s; } template Type(s

Re: CT Inheritence structures

2016-08-19 Thread Enamex via Digitalmars-d-learn
On Saturday, 20 August 2016 at 00:46:15 UTC, Engine Machine wrote: I am trying to get Timon Gehr's code working, with some modifications: void main() { import std.traits; auto a = new Type!("Animal", "Dog", "Pug")(); Type!("Animal", "Dog") b = a; Type!("

CT Inheritence structures

2016-08-19 Thread Engine Machine via Digitalmars-d-learn
I am trying to get Timon Gehr's code working, with some modifications: public template TypeParent(P) { import std.traits; alias T = TemplateArgsOf!P; alias Seq(T...) = T; static if (T.length == 0 || is(typeof(T[0]) == typeof(null))) {