我是一个彻头彻尾的 C++ 菜鸟,我在从我的方法返回数组时遇到了一些问题。我有一个包含以下方法声明的头文件:
virtual double[]
echoDoubleArray(double[] doubleArray, int arraySize) throw (RemoteException);
这给了我以下错误:
../common/EchoService.h: At global scope:
../common/EchoService.h:25: error: expected unqualified-id before ‘[’ token
返回数组的正确方法是什么?
最佳答案
C++ 不能很好地处理非本地数组,更有可能你应该使用像 std::array<double,10>
这样的实际容器或 std::vector<double>
.我认为不可能从函数返回数组。
关于c++ - C++ 中的返回数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7936351/