我有两个类“IDASectionA”和“XIDA_A”以及两个结构“s_Color”和“s_GetColor”。
s_Color,s_GetColor:
struct s_Color{
std::string Name;
XColor X_Color;
};
struct s_GetColor{
s_Color BackColor, BorderColor[3], BorderColorA, ForeColor, ForeColorA;
s_Color Min[3], Max[3], Close[3];
XColor Transparent;
};
XIDA_A:
XIDA_A{
...
s_GetColor s_Section, s_Header, s_StatBox;
int GetXColors(s_GetColor *vSec, s_GetColor *vHead, s_GetColor *vStatBox);
};
int XIDA_A::GetXColors(s_GetColor *vSec, s_GetColor *vHead, s_GetColor *vStatBox){ // <- HERE "Set but not used
...
vSec = &this->s_Section;
vHead = &this->s_Header;
vStatBox = &this->s_StatBox;
}
IDASectionA:
class IDASectionA{
...
s_GetColor *mCrSec, *mCrHead, *mCrStatBox;
};
IDASectionA::IDASectionA(){
mXIDA_A->GetXColors(this->mCrSec, this->mCrHead, this->mCrStatBox);
}
为什么vSec,vHead,vStatBox没有设置但没有使用?
BTW代码也无法正常工作。价值观多种多样......
使用返回的向量正确匹配。
最好的问候 Earlybite
答案 0 :(得分:1)
您正在更改功能本地指针
的地址int XIDA_A::GetXColors(s_GetColor *vSec, s_GetColor *vHead, s_GetColor *vStatBox)
要在函数外部修改这些指针,请通过引用传递它们
int XIDA_A::GetXColors(s_GetColor*& vSec, s_GetColor*& vHead, s_GetColor*& vStatBox)