"The total size of a static array cannot exceed 16Mb."
    Janice Caron 
    caron800 at googlemail.com
       
    Tue Oct  2 00:42:45 PDT 2007
    
    
  
On 10/2/07, Vladimir Panteleev <thecybershadow at gmail.com> wrote:
> If you mean that I do something like:
>         int[4096][4096]* arr = (new int[4096][4096][1]).ptr;
Why not just
class Array2D(T)
{
    this(int width, int height)
    {
        this.width = width;
        a = new T(width * height);
    }
    T opIndex(int x, int y)
    {
        return a[x * width + y];
    }
    void opIndexAssign(T n, int x, int y)
    {
        a[x * width + y] = n;
    }
    T[] a;
    int width;
}
Then
    arr = new Array2D(4096,4096);
    
    
More information about the Digitalmars-d
mailing list