Thread overview
[Issue 23383] csvReader throws ArrayIndexError when Contents has more fields than header.length
Oct 05, 2022
Jesse Phillips
Dec 17, 2022
Iain Buclaw
October 05, 2022
https://issues.dlang.org/show_bug.cgi?id=23383

Jesse Phillips <Jesse.K.Phillips+D@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Jesse.K.Phillips+D@gmail.co
                   |                            |m

--- Comment #1 from Jesse Phillips <Jesse.K.Phillips+D@gmail.com> ---
I think you're probably right, but what about

    class Layout
    {
        int value;
        double other;
        string name;
    }

struct Cache {
    Layout data;
    alias data this;
    int extra_field;  // un-comment to see the error

   static Cache opCall(Layout d) {
       Cache c;
       c.data = d;
       return c;
   }
}

void main()
{
    import std.csv;
    import std.stdio: write, writeln, writef, writefln;
    import std.algorithm.comparison : equal;
    import std.algorithm : map;
    string text = "a,b,c\nHello,65,2.5\nWorld,123,7.5";

    auto records =
        text.csvReader!Layout(["b","c","a"])
       .map!(x => Cache(x)) ;  // Read only these column
    foreach (r; records) writeln(r.name);
}

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23383

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 01
https://issues.dlang.org/show_bug.cgi?id=23383

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10501

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--