1
鑑於C++函數痛飲通行證的std ::由參考矢量/出從C#到C++
void Foo(unsigned int _x, unsigned int _y, std::vector< unsigned int > &_results)
而痛飲接口文件映射的std ::矢量在C#鍵入VectorUInt32
%include "std_vector.i"
namespace std {
%template(VectorUInt32) vector<unsigned int>;
};
我得到了C#代碼如下結果:
public static void Foo(uint _x, uint _y, VectorUInt32 _results)
這是偉大的,但我真的希望是這樣的:
public static void Foo(uint _x, uint _y, out VectorUInt32 _results)
有誰知道如何的std ::矢量從C++作爲ref或out PARAM映射到C#?
作品對我來說太。小的澄清:它的工作原理是因爲SWIG生成C#VectorUInt32作爲引用類型(因爲類不是結構體),所以C#Foo不需要爲_result使用ref(或out)修飾符。 – Sonic78