Possible Duplicate:
why isnt it legal to convert (pointer to pointer to non-const) to a (pointer to pointer to a const)
I have a function:
bool isCirclePolygonIntersection(const Point*, const int*, const Point*,
const Point**, const int*);
and I'm trying to call it like this:
isCirclePolygonIntersection(p, &r, poly_coord, poly, &poly_size)
where poly
defined like this:
Point** poly = new Point*[poly_size];
and there is a compiler error when I'm trying to compile it:
error C2664: 'isCirclePolygonIntersection' : cannot convert parameter 4 from 'Point **' to 'const Point **'
1> Conversion loses qualifiers
from what I've learned is that you cannot give const
argument to function when a function expects a non const
argument, but it's fine otherwise.
Does anyone knows what is the problem??
Thanks.
You're correct; you can implicitly convert a T *
to a const T *
. However, you cannot implicitly convert a T **
to a const T **
. See this from the C FAQ: http://c-faq.com/ansi/constmismatch.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With