On Thursday, 15 January 2015 at 06:02:13 UTC, Vlad Levenfeld wrote:
For optimal AA lookup, this idiom is also nice if you only need the result for one line:

  if (auto found = key in AA)
    do_stuff (found);


Having a declaration in an "if" could be another entry together with:


    if (auto inst = cast(SubClass)myObject)
        do_stuff(inst);

How to do "instanceof" is quite a common question on IRC.

Reply via email to