Commit cd4f44d
authored
After this,
```julia
julia> S = StructArray{Complex{Int}}(([1,2], [3,4]))
2-element StructArray(::Vector{Int64}, ::Vector{Int64}) with eltype Complex{Int64}:
1 + 3im
2 + 4im
julia> empty(S)
0-element StructArray(::Vector{Int64}, ::Vector{Int64}) with eltype Complex{Int64}
```
instead of
```julia
julia> empty(S)
Complex{Int64}[]
```
This behavior matches the docstring now: "Create an empty vector similar
to `v`". Often, `similar` will fall back to creating a `Vector`, so the
current behavior will be preserved.
~I'm unsure about what test to add for this, so suggestions are
welcome.~ Test added for a `StructArray` through a new test helper
1 parent c3836e1 commit cd4f44d
File tree
3 files changed
+53
-1
lines changed- base
- test
- testhelpers
3 files changed
+53
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
884 | | - | |
| 884 | + | |
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
1019 | 1022 | | |
1020 | 1023 | | |
1021 | 1024 | | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
1022 | 1035 | | |
1023 | 1036 | | |
1024 | 1037 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments