T const& versus T& const

Dec 12, 2014 at 10:13am
Hi everyone,

I know
1
2
T const* a; // Pointer to T, object cannot be modified
T * const a; // Pointer to T, pointer cannot be modified. 


Now I was wondering if in the following example:

1
2
T const& a; // Object of type T, cannot be modified
T& const a; // ? 


The last one has any meaning? Does it? Or is it exactly the same as the first one?
Dec 12, 2014 at 10:19am
I can't even get T& const a to compile.
Dec 12, 2014 at 10:25am
References are immutable by definition, so applying const to them is redundant and illegal
Dec 12, 2014 at 10:50am
Yes, makes sense. Thanks!
Topic archived. No new replies allowed.