Consider this piece:
template <int N> void fill_with_magic(array<int, N>& whatever){
for(int i = 0; i < N; i++){
whatever[i] = magic(i, N);
}
}
I call it by specific instance so for array of 3 I would have to do:
array<int, 3> some_array_of_3;
fill_with_magic<3>(some_array_of_3);
But do I really have to write <3>
? Compiler already knows the array size so theoretically it could of infer the right instance based on that size. Can I really make it do that?