用C++返回数组

Max*_*Max 1 c++ arrays return

我是一个完全的C++ noob,我在从我的方法返回数组时遇到了一些麻烦.我有一个头文件与以下方法声明:

virtual double[]
echoDoubleArray(double[] doubleArray, int arraySize) throw (RemoteException);
Run Code Online (Sandbox Code Playgroud)

这给了我以下错误:

../common/EchoService.h: At global scope:
../common/EchoService.h:25: error: expected unqualified-id before ‘[’ token
Run Code Online (Sandbox Code Playgroud)

返回数组的正确方法是什么?

Moo*_*uck 6

C++不适合非本地数组,更有可能你应该使用像std::array<double,10>或的实际容器std::vector<double>.我不认为从函数返回数组是可能的.