[Issue 24037] New: assocArray should support immutable values
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Jul  7 09:03:39 UTC 2023
    
    
  
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 at puremagic.com
          Reporter: default_357-line at 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)`.
--
    
    
More information about the Digitalmars-d-bugs
mailing list