Re: Template shenannigans with multiple datatypes

2022-05-13 Thread zjh via Digitalmars-d-learn
On Friday, 13 May 2022 at 13:06:32 UTC, vit wrote: On Friday, 13 May 2022 at 11:58:15 UTC, zjh wrote: Thank you for your detail explain.

Re: Template shenannigans with multiple datatypes

2022-05-13 Thread Ali Çehreli via Digitalmars-d-learn
On 5/13/22 00:32, Chris Katko wrote: > Luckily, because I'm painting them to the screen, the > buffers only really need to be float even if they started as a boolean, > int, or double. However, if I'm keeping a list of pointers to things I > want to snoop when I call onTick(), I can't think of a

Re: Template shenannigans with multiple datatypes

2022-05-13 Thread frame via Digitalmars-d-learn
On Friday, 13 May 2022 at 07:32:16 UTC, Chris Katko wrote: This is a kinda "dynamic language" feature but it feels like this information is theoretically, knowable at static, compile-time. I know what the variable types will be at compile-time, but I don't know how to put them all in one

Re: Template shenannigans with multiple datatypes

2022-05-13 Thread vit via Digitalmars-d-learn
On Friday, 13 May 2022 at 11:58:15 UTC, zjh wrote: On Friday, 13 May 2022 at 08:28:56 UTC, vit wrote: ... ```d ... this(DataSources dataSources){ this.dataSources = dataSources; } ... return new MultiGraph!(staticMap!(PointerTarget, Ts))(ts);//ts ``` How is `ts` convert to

Re: Template shenannigans with multiple datatypes

2022-05-13 Thread zjh via Digitalmars-d-learn
On Friday, 13 May 2022 at 08:28:56 UTC, vit wrote: ... ```d ... this(DataSources dataSources){ this.dataSources = dataSources; } ... return new MultiGraph!(staticMap!(PointerTarget, Ts))(ts);//ts ``` How is `ts` convert to `DataSources`?

Re: Template shenannigans with multiple datatypes

2022-05-13 Thread vit via Digitalmars-d-learn
On Friday, 13 May 2022 at 07:32:16 UTC, Chris Katko wrote: On Friday, 13 May 2022 at 07:05:36 UTC, vit wrote: On Friday, 13 May 2022 at 06:43:39 UTC, Chris Katko wrote: I have an intrinsicGraph(T) class that is given a pointer to a T dataSource and automatically polls that variable every

Re: Template shenannigans with multiple datatypes

2022-05-13 Thread Chris Katko via Digitalmars-d-learn
On Friday, 13 May 2022 at 07:05:36 UTC, vit wrote: On Friday, 13 May 2022 at 06:43:39 UTC, Chris Katko wrote: I have an intrinsicGraph(T) class that is given a pointer to a T dataSource and automatically polls that variable every frame to add it to the graph, whether it's a float, double,

Re: Template shenannigans with multiple datatypes

2022-05-13 Thread vit via Digitalmars-d-learn
On Friday, 13 May 2022 at 06:43:39 UTC, Chris Katko wrote: I have an intrinsicGraph(T) class that is given a pointer to a T dataSource and automatically polls that variable every frame to add it to the graph, whether it's a float, double, integer, and maybe bool. [...] I dont understand

Template shenannigans with multiple datatypes

2022-05-13 Thread Chris Katko via Digitalmars-d-learn
I have an intrinsicGraph(T) class that is given a pointer to a T dataSource and automatically polls that variable every frame to add it to the graph, whether it's a float, double, integer, and maybe bool. This all works fine if you have a single template type. But what if I want ... multiple