Clinton wrote:

On Monday, 19 February 2018 at 14:55:01 UTC, Clinton wrote:
Hi all, I need advice from better developers on this concern.

I'm using an AA to reference another array for quicker access:


Sorry, on second look my explanation isn't very clear. I want to know if:

bool[string] myAA;

myAA[] = true; // Does this copy or is this a pointer to

there is absolutely no reason to copy `string` ever, as it is `immutable`. and compiler knows that. anyway, why don't you just check it by writing the code first?

        import std.stdio;
        void main () {
                int[string] a;
                string s = "test";
                writefln("%08x", s.ptr);
                a[s] = 666;
                s = "test1";
                writefln("%08x", s.ptr);
                a[s] = 42;
                foreach (string k; a.byKey) writefln("%08x", k.ptr);

Reply via email to