64,648
社区成员
发帖
与我相关
我的任务
分享
const t_rnxObs* hlp[header.nTypes(sys)]; //主要是这个变量的赋值问题,t_rnxObs是一个结构体,有三个double型变量
for (int iTypeV3 = 0; iTypeV3 < header.nTypes(sys); iTypeV3++) {
hlp[iTypeV3] = 0; //================1.
QString typeV3 = header.obsType(sys, iTypeV3);
QMapIterator<QString, t_rnxObs> itObs(rnxSat.obs);
// Exact match
// -----------
while (itObs.hasNext()) {
itObs.next();
const QString& type = itObs.key();
const t_rnxObs& rnxObs = itObs.value();
if (typeV3 == type2to3(sys, type) && rnxObs.value != 0.0) {
hlp[iTypeV3] = &itObs.value(); //================2.
}
}
// Non-Exact match
// ---------------
itObs.toFront();
while (itObs.hasNext()) {
itObs.next();
const QString& type = itObs.key();
const t_rnxObs& rnxObs = itObs.value();
if (hlp[iTypeV3] == 0 && typeV3 == type2to3(sys, type).left(2) && rnxObs.value != 0.0) {
hlp[iTypeV3] = &itObs.value(); ////================3.
}
}
}
class t_rnxObs {
public:
t_rnxObs() {
value = 0.0; lli = 0; snr = 0;
}
double value;
int lli;
int snr;
};
[/quote]
根据你的错误类型, 可以推测应该是=运算符没有被重载吧, 类对象和类对象赋值是需要重载=运算符的.
没有完整的代码, 只能给你分析到这里了 [/quote]
如下编译OK的啊,检查下你定义的数组维数:
#include "stdafx.h"
class t_rnxObs{
public:
t_rnxObs(){
value = 0.0; lli = 0; snr = 0;
}
double value;
int lli;
int snr;
};
int _tmain(int argc, _TCHAR* argv[])
{
const t_rnxObs* hlp=new t_rnxObs[5];
return 0;
}
class t_rnxObs {
public:
t_rnxObs() {
value = 0.0; lli = 0; snr = 0;
}
double value;
int lli;
int snr;
};
[/quote]
根据你的错误类型, 可以推测应该是=运算符没有被重载吧, 类对象和类对象赋值是需要重载=运算符的.
没有完整的代码, 只能给你分析到这里了
class t_rnxObs {
public:
t_rnxObs() {
value = 0.0; lli = 0; snr = 0;
}
double value;
int lli;
int snr;
};