www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3962] New: AssociativeArray!(K,V) .init has no [ ] operator

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3962

           Summary: AssociativeArray!(K,V) .init has no [ ] operator
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: philippe.sigaud gmail.com


--- Comment #0 from Philippe Sigaud <philippe.sigaud gmail.com> 2010-03-14
22:13:41 CET ---
This code doesn't work:

auto aa = (int[int]).init; // aa is an AssociativeArray!(int,int)
aa[3] = 2; // Error, no [] operator overload for type
AssociativeArray!(int,int)

whereas this works, obviously:

int[int] aa;
aa[3] = 2;

It's problematic for generic code and for template constraints where .init is
the only way to get a value from a type.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 14 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3962


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


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