Hello, I have the following setup: I want to initialize an array with a element-type which is given by a return type of a function. Something like this:
A = Array{typeof(f(1))}(undef, 10)
for 1 in 1:10
A[i] = f(i)
end
This works but it calls the function f(1) explicitly. is there a good way to just get the return type without the need to call the function. In the real case the call is a time-heavy calculation.
I was able to use Base.return_types(f, (Int,))[1] but this seams to be a clumsy way, isn’t it?