With the following code
void TestF(const double ** testv){;}
void callTest(){
double** test;
TestF(test);
}
I get this:
'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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…