Skip to content

julia - Fix type conversion bug #2979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions modules/julia/gen/jl_cxx_files/types_conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ function julia_to_cpp(var::Array{Vec{T, N}, 1}) where {T, N}
return ret
end

function julia_to_cpp(var::Array{T}) where {T}
if size(var, 1) == 0
return CxxWrap.StdVector{T}()
end
ret = CxxWrap.StdVector{typeof(julia_to_cpp(var[1]))}()
for x in var
push!(ret, julia_to_cpp(x))
end
return ret
end

function cpp_to_julia(var::CxxWrap.StdVector{T}) where {T <: CxxScalar}
ret = Array{Scalar, 1}()
for x in var
Expand All @@ -54,4 +65,15 @@ function cpp_to_julia(var::CxxWrap.StdVector{CxxVec{T, N}}) where {T, N}
push!(ret, cpp_to_julia(x))
end
return ret
end

function cpp_to_julia(var::CxxWrap.StdVector{T}) where {T}
if size(var, 1) == 0
return Array{T}()
end
ret = Array{typeof(cpp_to_julia(var[1])), 1}()
for x in var
push!(ret, cpp_to_julia(x))
end
return ret
end