columnar struct storage template

Nestor via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Jan 29 06:59:29 PST 2017


On Sunday, 29 January 2017 at 14:16:37 UTC, ezneh wrote:
> Here :
>
>  foreach(uint  u; FooCol.j) writef("%s ", u); writef(\n);

I see, but apparently this isn't the only issue. I replaced the 
whole unittest with this, and it still doesn't compile:

import std.stdio;
void main() {
   struct MyStruct {
     uint   i;
     float  j;
   }
   MyStruct data;
   Columns!(MyStruct) MyCols;
}

Problems this time were in the AfterLast function, which I 
modified like this:

string AfterLast(string s, char c) {
   foreach_reverse(int i, char d; s) if(c==d) return s[i+1..$];
   return s;
}

However there are still some errors which I don´t know how to fix:

columns1.d(45): Error: cannot implicitly convert expression 
(this) of type Columns!(MyStruct) to Columns!(MyStruct)*
columns1.d(63): Error: template instance 
columns1.Columns!(MyStruct) error instantiating


Line 63 is the declaration of MyCols, and line 45 would be thisÑ

At opIndex(uint i) { return At(this,i); }


More information about the Digitalmars-d-announce mailing list