Be careful, I'm just interested in the possibility of C ++ syntax, and not in practical use.
It is easy to determine the type of array. As an example, int a[3];determines the type of array 3 int, const int a[3];or int const a[3];determines the type of array 3 const int. None of the three forms actually defines a const array of some type T(which itself can be const-modified, of course). Therefore, the following code will not compile:
void f(int (&a)[3]) {...}
f({1, 2, 3});
The reason is simple: the reference is not a constant lval cannot be bound to a temporary rval. One way to fix the code:
typedef int ArrOfInt[3];
void f(const ArrOfInt& a) {...}
f({1, 2, 3});
: ++ const, typedef ?