casting & templates

2016-01-31 Thread Robert M. Münch via Digitalmars-d-learn
I have: class OperatorV(T) : Value { T impl; this(T impl) { this.impl = impl; } ... and use it like this: makeOperator((IntV a, IntV b) => new IntV(a.num + b.num)); Now I want to do: opWord.get() returns a Value OperatorV *op = cast(OperatorV*)(opWord.get()); and get: Error: class ap

Re: casting & templates

2016-01-31 Thread Chris Wright via Digitalmars-d-learn
On Sun, 31 Jan 2016 19:59:01 +0100, Robert M. Münch wrote: > I have: > > class OperatorV(T) : Value { > T impl; > > this(T impl) { > this.impl = impl; > } > ... This expands to: template OperatorV(T) { class OperatorV { ... } } If you're just typing `OperatorV` with no templ