On Wednesday, 15 January 2014 at 20:34:32 UTC, Andre wrote:
        foreach(entry;entries){
                if (entry.key == 3){
                        entry.value = 42;
                        found = true;
                }
        }


One thing to keep in mind is that structs are passed by value, so
this foreach would be operating on a copy of the entry. So your
setting the value to 42 would have no effect.

Instead you would need "foreach(ref entry; entries)" in order to
have the change take effect (regardless of whether or not you use
std.algorithm).

Reply via email to