Hi all,
References are (almost always) implemented as constant pointers.
We can certainly have an array of constant pointers.
But then why we cannot have array of references?
I can think of atleast two places where such a thing 'might' be used,
though I am not clear whether it makes sense to have such a usage -
1) Function call
int f (int& a[]); // a is an array of integer references
2) simple definition :
void foo()
{
const int& p[] = { 2,3,4,5}; // p is an array of references to const
integers.
}
Thanks in advance,
Neelesh
References are (almost always) implemented as constant pointers.
We can certainly have an array of constant pointers.
But then why we cannot have array of references?
I can think of atleast two places where such a thing 'might' be used,
though I am not clear whether it makes sense to have such a usage -
1) Function call
int f (int& a[]); // a is an array of integer references
2) simple definition :
void foo()
{
const int& p[] = { 2,3,4,5}; // p is an array of references to const
integers.
}
Thanks in advance,
Neelesh
Comment