There is no such thing as a const
link, a link is never const
. Code like this does not compile:
int& const i;
Now, if you want to remove your link, this will work. If you put const
on the right side (semantically the same thing) and read the type back
CEmptyClass const&
he would read a reference to const CEmptyClass, not a reference to CEmptyClass constant.
Update: Now that you have changed the link to the pointer, the same incorrect construction is preserved:
const CEmptyClass* CEmptyClass const*
both are the same, the pointer is not const for CEmptyClass constant
CEmptyClass* const
is a const pointer to CEmptyClass
and
const CEmptyClass* const CEmptyClass const* const
are const pointers to const CEmptyClass.
source share