nested templates using Complex! with slices, ... confused, I am!
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Aug 9 18:44:01 UTC 2021
On Mon, Aug 09, 2021 at 06:35:56PM +0000, james.p.leblanc via Digitalmars-d-learn wrote:
[...]
> > **T[] foo_temp(Complex!T[])(T x, T y){
> > auto r = [x, x];
> > auto i = [y, y];
> > auto z = [ Complex!T(x, y), Complex!T(x,y) ];
> > return z;
> > }**
Your syntax is wrong; the declaration should be:
Complex!T[] foo_temp(T)(T x, T y) { ... }
Basically, you're parametrizing on T, and returning an array of a
Complex type built upon T.
T
--
Curiosity kills the cat. Moral: don't be the cat.
More information about the Digitalmars-d-learn
mailing list