excplicitly casting constness in
Posted
by
jimifiki
on Stack Overflow
See other posts from Stack Overflow
or by jimifiki
Published on 2013-11-11T15:44:53Z
Indexed on
2013/11/11
15:53 UTC
Read the original article
Hit count: 240
With the following code
void TestF(const double ** testv){;}
void callTest(){
double** test;
TestF(test);
}
I get this:
error C2664: 'TestF' : cannot convert parameter 1 from 'double **' to 'const double **'
I cannot understand why. Why test cannot be silently casted to const double**? Why should I do it explicitly? I know that
TestF(const_cast<const double**>(test))
makes my code correct, but I feel this should be unnecessary.
Are there some key concepts about const that I'm missing?
© Stack Overflow or respective owner