static array in templated struct/class

Daniel Gibson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 5 12:15:09 PDT 2014


Am 05.08.2014 21:13, schrieb "Marc Schütz" <schuetzm at gmx.net>":
> On Tuesday, 5 August 2014 at 18:36:35 UTC, ddos wrote:
>> alias Vec4f = TVector!(float,4);
>> alias Vec3f = TVector!(float,3);
>>
>> class TVector(T,int n)
>> {
>>     T[n] val;
>> ...
>>
>> TVector as class does work as expected, as a struct i get the
>> following errors, but why?
>>
>> struct Vector.TVector!(float, 4).TVector no size yet for forward
>> reference
>> struct Vector.TVector!(float, 3).TVector no size yet for forward
>> reference
>
> Can you show the complete code? I cannot reproduce this with either
> latest DMD git, DMD 2.065, or LDC 0.13.0:
>
>      alias Vec4f = TVector!(float,4);
>      alias Vec3f = TVector!(float,3);
>
>      struct TVector(T,int n)
>      {
>          T[n] val;
>      }
>
>      Vec3f a;
>      Vec4f b;

struct vs class?


More information about the Digitalmars-d-learn mailing list