Hello. I want to pass to a certain function, a reference to a fixed size array of a user defined struct "Sphere":

Code:
void trace (Image& image, Sphere (&sphere_array) [3]) {
However this results in:

Code:
main.cpp:39:29: error: invalid initialization of reference of type ‘Sphere (&)[3]’ from expression of type ‘Sphere [n_spheres]’
    trace (image,sphere_array);
                             ^
main.cpp:24:6: note: in passing argument 2 of ‘void trace(Image&, Sphere (&)[3])’
 void trace (Image&, Sphere (&) [3]);
However,if I change
Code:
void trace (Image& image, Sphere (&inArray) [3])
to:
Code:
void trace (Image& image, int (&in_array) [4])
it works. Can't the compiler deduce the array size when using use defined types? Is that the cause? Is there a workaround to make it work? Anyway, I assume I will have to put the array inside a struct and pass it by reference instead, which probably I am going to do in the future anyway.