https://issues.dlang.org/show_bug.cgi?id=15038
Issue ID: 15038
Summary: Associative Array .get property const vs immutable
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
An associative array of string[string] can't be indexed with .get using a
const(char)[], unlike normal/raw indexing:
void main()
{
string[string] foo = ["k": "v"];
const(char)[] key = "k";
string value;
// if this works...
assert(foo[key] == "v");
// and this works...
string* pValue = key in foo;
value = pValue ? *pValue : null;
assert(value == "v");
// ...then this should work
//assert(foo.get(key, null) == "v");
}
--