【发布时间】:2013-07-15 13:03:34
【问题描述】:
从 C++ 转换到 C++/CX 我偶然发现 ref 类不能在它们是公共或受保护的成员中包含本机成员,因为 java 和其他东西可能存在错误。相反,我们现在必须使用属性,我可以制作但只能保存 1 个值...
这个想法是创建一个在数组或向量中存储 4 个浮点数的属性,然后将值传递给 XMVECTOR。到目前为止我在类头文件中的相关代码是:
public:
property std::vector<float> num{
void set(std::vector<float> e){
NUM = e;
};
std::vector<float> get(){
return NUM;
};
};
private:
std::vector<float> NUM;
稍后在 .cpp 文件中我会这样做:
std::vector<float> g;
g.pushback(3);
num = g;
我也将它作为一个字符串传递给 TextBox(但这并不重要)。最后我得到了很多类似的错误...... 2个错误是:
error C3986: 'set': signature of public member contains native type 'std::vector<_Ty>'
error C3986: 'set': signature of public member contains native type 'std::allocator<_Ty>'
我唯一想到的是我不能使用字符串或向量。我知道 Platform::Strings 存在,但是向量呢??
【问题讨论】:
标签: visual-c++ c++11 windows-runtime directx-11 c++-cx