|
123 | 123 | _ntuple(f, n) = (@_noinline_meta; ([f(i) for i = 1:n]...))
|
124 | 124 |
|
125 | 125 | # inferrable ntuple
|
| 126 | +ntuple(f, ::Type{Val{0}}) = (@_inline_meta; ()) |
| 127 | +ntuple(f, ::Type{Val{1}}) = (@_inline_meta; (f(1),)) |
| 128 | +ntuple(f, ::Type{Val{2}}) = (@_inline_meta; (f(1), f(2))) |
| 129 | +ntuple(f, ::Type{Val{3}}) = (@_inline_meta; (f(1), f(2), f(3))) |
| 130 | +ntuple(f, ::Type{Val{4}}) = (@_inline_meta; (f(1), f(2), f(3), f(4))) |
| 131 | +ntuple(f, ::Type{Val{5}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5))) |
| 132 | +ntuple(f, ::Type{Val{6}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6))) |
| 133 | +ntuple(f, ::Type{Val{7}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7))) |
| 134 | +ntuple(f, ::Type{Val{8}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8))) |
| 135 | +ntuple(f, ::Type{Val{9}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9))) |
| 136 | +ntuple(f, ::Type{Val{10}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9), f(10))) |
| 137 | +ntuple(f, ::Type{Val{11}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9), f(10), f(11))) |
| 138 | +ntuple(f, ::Type{Val{12}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9), f(10), f(11), f(12))) |
| 139 | +ntuple(f, ::Type{Val{13}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9), f(10), f(11), f(12), f(13))) |
| 140 | +ntuple(f, ::Type{Val{14}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9), f(10), f(11), f(12), f(13), f(14))) |
| 141 | +ntuple(f, ::Type{Val{15}}) = (@_inline_meta; (f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9), f(10), f(11), f(12), f(13), f(14), f(15))) |
| 142 | + |
126 | 143 | function ntuple{F,N}(f::F, ::Type{Val{N}})
|
127 | 144 | Core.typeassert(N, Int)
|
128 | 145 | _ntuple((), f, Val{N})
|
|
0 commit comments