On 04/07/2015 07:40 PM, Timothee Cour via Digitalmars-d-learn wrote:
Eg, code like this in std.algorithm:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9][]));
why not just:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9]));
?


It must be a leftover from the time when the type of an array literal was a static array (versus a dynamic one). Since static arrays are not ranges, the author of the code apparently has first created a slice to its elements.

However, today array literals are already slices.

Ali

Reply via email to