我有一个函数声明为:
int myFunction(const float** ppArr, const int n, const int m);
当我这样调用它时:
float** ppArr = new float*[5];
// Some initialization of ppArr
int result = myFunction(ppArr, 5, 128); <<<< Error
错误是(VS 2008 Express):
error C2664: 'Test_myFunction.cpp' : cannot convert parameter 1 from 'float **' to 'const float **'
WTF?我正在将 float** 转换为 const float**。这可能出什么问题了? :/
编辑:感谢您难以置信的快速回复!!! :)
最佳答案
请阅读"Why am I getting an error converting a Foo** → Foo const**?"在 C++ 常见问题解答中。
关于c++ - C/C++ 转换为 const 怪异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5408342/