Use similar instead of Array when allocating new arrays.
Merge pull request #6167 from JuliaLang/anj/similar

Use `similar` instead of `Array` when allocating new arrays.