July 07, 2023 [Issue 24037] New: assocArray should support immutable values | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24037 Issue ID: 24037 Summary: assocArray should support immutable values Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: default_357-line@yahoo.de ``` import std.array; import std.typecons; immutable struct S { int a; } void main() { auto array = [tuple!("key", "value")(2, S(1))].assocArray; } ``` Leads to Error: static assert: "assocArray: value type must be mutable" Since `assocArray(keys, values)` can construct an immutable assoc array just fine, this should also work with `assocArray(range)`. -- |
Copyright © 1999-2021 by the D Language Foundation