我定义了一个阵列" pointsarray"在c ++ cx中,我试图为它分配一个正常的浮点值:
定义:
bool getPoints(Platform::Array<float>^* pointsarray)
作业(在上面显示的功能中):
pointsarray[0] = points[0].x;
错误讯息:
类型&#34;&#34;浮动&#34;&#34;无法分配给&#34;&#34;平台::数组&lt;类型的实体float,1U&gt; ^&#34;&#34;
是否可以将浮点值转换为cx数组(指针)?
答案 0 :(得分:1)
yAxis: {
tickPositioner: function() {
return [this.dataMin, this.dataMax];
}
},
是不必要的。您已通过*
将pointsarray
声明为托管参考。所以使用这个:
^
修改:根据https://msdn.microsoft.com/en-us/library/hh700131.aspx
使用bool getPoints(const Platform::Array<float>^ pointsarray)
当客户端代码将数组传递给C ++方法并且方法不修改它时,该方法接受数组作为const数组^。