Ops! I accidentally hit the post button! So the post is not completed!
It is an example:
foo(::Val{1}) = 1
foo(::Val{2}) = 2
foo(::Val{2}) = 3
function bar()
s = 0
for t in Datatype[Val{k} for k in 1:3]
s += foo(t)
end
end
Will there be any performance issue if I loop over types?
I am still trying to understand how the multiple-dispatch works. Sometimes
I am confused!
On Friday, June 10, 2016 at 6:37:31 PM UTC-7, Po Choi wrote:
>
>
>
> foo(::Val{1}) = 1
> foo(::Val{2}) = 2
> foo(::Val{2}) = 3
>
> function bar()
>
> for t in Datatype[Val{k} for k in 1:3]
>
> end
> end
>
>
>
>
>
>
>
>
>
>
>