I've come across the following signature
double(&rotate_vec(double(&val)[4]))[4];
In the comments it "claims" to accept and return an array of four elements. My first reaction was that this does not even look standard c++ yet this compiles:
double(&rotate_vec(double(&val)[4]))[4]
{
// ...
return val;
}
int main()
{
double ar[4] = { 1, 2, 3, 5 };
rotate_vec(ar);
return 0;
}
- How is this c++ ? How would you read it ?
- We can't return an array from a function, just pointers, or can we ?