Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Is there a Function type which captures its return type

$
0
0

I have a struct which should contain a parametrized function returning a certain type.
Can I impose this type restriction onto the struct field?

using Unitful
struct a 
T::Function # This will allow any function
end

obj = a((t)->3u"K/s"*t)
energy = obj.T(1u"s")

5 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795