Why it is impossible to create an array of references in c++? Why it is impossible to create an array of references in c++? arrays arrays

Why it is impossible to create an array of references in c++?


Because indexation into an array is actually defined in terms of an implicit conversion to a pointer, then pointer arithmetic. So to support this, you'd have to also support pointers to references, and define what pointer arithmetic means on them.


Because references aren't objects. References were primarily introduced to support call by reference and return by reference without inserting & at call-site. What you probably want is an array of pointers.


A reference cannot be reassigned, and has no size.

If arrays of references were allowed they would therefore have to be treated in a special way then.