How can I test at compile time whether T is an instance of an interface ?
data.pulverizer at gmail.com
Thu Sep 24 07:28:33 UTC 2020
On Wednesday, 23 September 2020 at 20:19:04 UTC, data pulverizer
Thinking more about it this ...
> class Middle: Node
> Node prev;
> Node next;
won't work because the I've told the compiler that the static
type is "Node", my original design was something like this:
struct Middle(P, N)
which also won't work because it can't actually be instantiated
(recursive), and the start and end nodes must be different types
(and you can't substitute the middle node for the start and end
node). It's the simplest case because there could be more than
one type of middle node. More generally, correct me if I'm wrong,
but I don't think these kinds of statically multityped tree
structures can be formed in static languages so I've been using
tuples - at least for the simple case I outlined.
More information about the Digitalmars-d-learn