On Wednesday, 6 August 2014 at 14:36:23 UTC, Marc Schütz wrote:

This would defeat the purpose, see the original post.

sorry, I red just the last post.

__gshared has no influence on this.

auto cmds = CONFIG.commands;
cmds["list"] = new Command(...);

cmds is a thread local variable referencing the shared AA. But if you add new elements to cmds, cmd will be reallocated and the shared AA will remain unchanged. Though, updated values of existing keys will be visible in the original, because no relocation takes place.

If you want to change the original you need a pointer or a reference (for a setter function).

auto cmds = &CONFIG.commands;
(*cmds)["list"] = new Command(...);

Reply via email to