Skip to content

Commit

Permalink
Avoid unnecessary conversions of nullable.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcjones committed Aug 1, 2015
1 parent 3b305b0 commit a4c0707
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base/nullable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Nullable() = Nullable{Union{}}()

eltype{T}(::Type{Nullable{T}}) = T

convert{T}(::Type{Nullable{T}}, x::Nullable{T}) = x

function convert{T}(::Type{Nullable{T}}, x::Nullable)
return isnull(x) ? Nullable{T}() : Nullable{T}(convert(T, get(x)))
end
Expand Down

0 comments on commit a4c0707

Please sign in to comment.