I saw recently (at last in this thread: http://forum.dlang.org/thread/tdfydchrairigdlgt...@forum.dlang.org#post-qakiogaqvmiwlneimhgu:40forum.dlang.org) that many users use
----
key in aa ? aa[key] : ValueType.init;
----
instead of
----
auto ptr = key in aa;
ptr ? *ptr : ValueType.init;
----
which is more economic.
Maybe you can add it to your list:

----
import std.stdio;

void main() {
        immutable string key = "foo";
        immutable string[string] arr = [key : "bar"];
        
        if (auto ptr = key in arr)
                writeln(*ptr);
}
----

Reply via email to