https://issues.dlang.org/show_bug.cgi?id=13381
--- Comment #4 from [email protected] --- (In reply to yebblies from comment #3) > For this case, and similar cases, the compiler can simply type the array > literal as a static array, because it knows that == can't escape any > references. It already does something like this for indexing array literals. I see. I have suggested a rewrite like this: if (a.length == 2 && a[0] == 1 && a[1] == 2) {} Because most array literals used for equality or comparison are short or very short, so calling == or < on few single items is much more efficient than calling a runtime function that works on whole arrays. --
