Bug 24037 – assocArray should support immutable values

Status
NEW
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-07-07T09:03:39Z
Last change time
2024-12-01T16:41:33Z
Assigned to
No Owner
Creator
FeepingCreature
Moved to GitHub: phobos#9860 →

Comments

Comment #0 by default_357-line — 2023-07-07T09:03:39Z
``` 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)`.
Comment #1 by robert.schadek — 2024-12-01T16:41:33Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9860 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB