Reputation: 4402
When writing this:
void foo(int*& x);
instead of &
neutralizing the *
, foo
accepts x
reference of a type int*
, if I understand correctly.
but what happens when I write this:
void foo(int&* x);
is that a pointer to a reference? will the compiler optimize it and take the actual value? since dereferencing a reference if the value it self.
EDIT:
so I can't take pointer to reference, but why is that? does it have to do with the address of the reference being a stack address?
Upvotes: 0
Views: 373
Reputation: 137310
§8.3.2 [dcl.ref]/p5:
There shall be no references to references, no arrays of references, and no pointers to references.
Upvotes: 3
Reputation: 136208
int&*
is not well-formed, no pointer to a reference can be taken.
Upvotes: 2