yi*****@gmail.com wrote:
Thanks. It works.
I have another question:
I have another funcion, which is this:
void f1(const A* aPtr);
A const *a = NULL;
if (!aList.empty()) {
a = getMaxArea(aList);
// try to call f1() here,
const A* a1 = a;
f1 (a1); // won't compile due to error: invalid conversion from
'const A*' to 'A*'
}
Any idea?
Are you sure the code above is actually the code that won't compile?
After writing code to put it in a suitable context it compiled just fine
for me. (By the way, when posting example code it helps a lot if you
provide something that can be directly cut and paste without any
additional context needed.)
For what it's worth, "const A *" and "A const *" are the same type, both
meaning "pointer to a const A".
--
Alan Johnson