Skip to content

Commit 457d1bb

Browse files
committed
Add conversion ctors for VectorOfArrays
1 parent f1d3971 commit 457d1bb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/vector_of_arrays.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ end
7878

7979
export VectorOfArrays
8080

81+
function VectorOfArrays{T,N}(A::AbstractVector{AbstractArray{U,N}}) where {T,N,U}
82+
R = VectorOfArrays{T,N}()
83+
append!(R, A)
84+
end
85+
86+
VectorOfArrays(A::AbstractVector{AbstractArray{T,N}}) where {T,N} = VectorOfArrays{T,N}(A)
87+
88+
89+
@static if VERSION < v"0.7.0-DEV.3138"
90+
Base.convert(VA::Type{VectorOfArrays{T,N}}, A::AbstractVector{AbstractArray{U,N}}) where {T,N,U} = VA(A)
91+
Base.convert(VA::Type{VectorOfArrays}, A::AbstractVector{AbstractArray{T,N}}) where {T,N} = VA(A)
92+
end
93+
8194

8295
function full_consistency_checks(A::VectorOfArrays)
8396
simple_consistency_checks(A)

0 commit comments

Comments
 (0)