Skip to content

Commit 392928d

Browse files
author
Miha Zgubic
committed
differentiate between versions
1 parent 79c6b64 commit 392928d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/to_vec.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ end
2222
to_vec(x::Vector{<:Real}) = (x, identity)
2323

2424
# get around the constructors and make the type directly
25-
@generated _force_construct(T, args...) = Expr(:new, :T, Any[:(args[$i]) for i in 1:length(args)]...)
25+
@generated function _force_construct(T, args...)
26+
return if VERSION >= 1.3
27+
Expr(:splatnew, :T, :args)
28+
else
29+
Expr(:new, :T, Any[:(args[$i]) for i in 1:length(args)]...)
30+
end
31+
end
2632

2733
# Fallback method for `to_vec`. Won't always do what you wanted, but should be fine a decent
2834
# chunk of the time.

0 commit comments

Comments
 (0)