digitalmars.D.bugs - [Issue 9585] New: Implement getPair() for Associative Arrays
- d-bugmail puremagic.com (37/37) Feb 24 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9585
- d-bugmail puremagic.com (10/10) Feb 24 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9585
- d-bugmail puremagic.com (7/8) Feb 24 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9585
- d-bugmail puremagic.com (7/8) Feb 24 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9585
http://d.puremagic.com/issues/show_bug.cgi?id=9585 Summary: Implement getPair() for Associative Arrays Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: druntime AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 16:44:21 PST --- This was requested recently in IRC. A getPair() function would return a key+val combination from an existing key (ideally as a struct), e.g.: void main() { string buffer = "abc def"; string abc = buffer[0 .. 3]; bool[string] hash; hash[abc] = true; auto pair = hash.getPair("abc"); // enhancement assert(pair.key is abc); // L9 assert(pair.val == true); // not the same as: alias Tuple!(string, "key", bool, "val") Tup; Tup tup; tup.key = "abc"; tup.val = hash["abc"]; assert(tup.key is abc); // this would fail assert(tup.val == true); } Note the importance of line 9, it is an 'is' check, not an equality check. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 24 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9585 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc Dupe of Issue 5466 ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 24 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9585 17:15:28 PST ---Dupe of Issue 5466 ?That's iteration, this is lookup. But you could say the two are related. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 24 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9585That's iteration, this is lookup. But you could say the two are related.You are right, sorry. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 24 2013