[Issue 13354] New: Algebraic.opIndex/opIndexAssign makes wrong assumptions on the index/value type
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Aug 22 03:24:37 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13354
Issue ID: 13354
Summary: Algebraic.opIndex/opIndexAssign makes wrong
assumptions on the index/value type
Product: D
Version: D2
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: sludwig at outerproduct.org
Currently both, the index and the value type for VariantN.opIndex(Assign) must
be allowed!T. This is an unreasonable assumption for Algebraic and examples
such as the following do not work because of this:
---
alias T = Algebraic!(int[string], int[]);
T v = ["a": 1, "b": 2];
assert(v["a"] == 1); // error
v["a"] = 0; // error
---
--
More information about the Digitalmars-d-bugs
mailing list