T const& versus T& const
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?
I can't even get T& const a
to compile.
References are immutable by definition, so applying const to them is redundant and illegal
Yes, makes sense. Thanks!
Topic archived. No new replies allowed.