[Issue 1886] Inserting into an AA of structs with opAssign results in ArrayBoundsError

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 16 12:59:22 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=1886


Michael Rynn <y0uf00bar at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |y0uf00bar at gmail.com


--- Comment #2 from Michael Rynn <y0uf00bar at gmail.com> 2009-12-16 12:59:21 PST ---
Its not adding just opAssign. Having post-blit in a struct can do it too.
Documentation on struct in Associative Arrays in D2 is out of date.  Probably
because it mostly does not work. To return a pointer to the struct have to take
address of this



struct pblit {
     int x;

     pblit* opAssign(ref const pblit S)
     {
         this.x = S.x;

     }

     this(this)
     {
     }
     ~this()
     {
     }
} 

void main(char[][] args)
{
    pblit[string]   map;
    string[pblit]   rmap;

    pblit val;
    val.x = 12;

    rmap[val] = "test";   // this works
    map["test"] = val;    // oops! range error
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list