import std;

    struct A
    {
        double val;
        bool isBig;
    }


    void main() {
        alias DListOfA = DList!A;
        DListOfA[string] temp;
        A a = {2.0, true};

DListOfA returnVal = temp.require("a", DListOfA());--> I wish I could use ref DListOfA here

        returnVal.insert(a);
        writeln(temp);
    }

On the reference page there is an example with class types only (https://dlang.org/spec/hash-map.html) but my type in associative array is a DList which is a struct type and that causes I am having a copy of my DList after require an operation. And of course my insert is happening to the copy and is not affecting to the associative array. ,


I wish I could use ref DListOfA returnVal = .... but we can't in D.

Can you please suggest alternatives?

Reply via email to