We have:
    class File
    {
        // WIN32_FIND_DATAW data;
    }

    void fastReadDir()
    {
        File[] files;

        // reserve space, allocating instances
        files = new File[]( 1000 );  // <--- trouble here ?

        // filling instances
        auto file = files.ptr;

        writeln( file.data );    // <--- or trouble here ?

        // ...
    }

Got:
    SegFault

Goal:
    Allocate memory for 1000 instances at once.

Source:
    https://run.dlang.io/is/xfaXcv

Question:
What is the true, fastest, beauty way to create 1000 instances of the class File ?


Reply via email to