1
Qt C++의 응용 프로그램에이 코드가 있습니다. 구조체를 비교하기위한 내 operator==
은 동등하더라도 항상 false를 반환합니다. 내 코드에 무슨 문제가 있습니까? 당신은 그들이 동일하지 않은 오류가있는 테오 긴 목록에서std :: tie를 사용하여 구조체 비교
struct pSettings
{
int speciality;
bool autoCompleteByWord;
bool showChronicConditions;
bool showNavArrows;
bool smallScreenMode;
bool simpleExamination;
bool alwaysSave;
bool inLinePatientList;
double newVisitPrice;
double followVisitprice1;
double followVisitprice2;
double followVisitprice3;
double followVisitprice4;
int autosaveinterval;
bool autoSave ;
bool minimizeToTray;
int selectedTheme;
QString textColor;
QString topBGColor;
QString bottomBGColor;
QString altWinColor;
QString buttonColor;
QString altButtonColor;
QString textBGColor;
QString borderColor1;
QString borderColor2;
QString altButtonColorHover;
QString buttonColorHover;
QString buttonColorDisabled;
QString buttonBorderColorHover;
QString comboBGcolor;
QString buttonTextColor;
QString comboTextColor;
double lOffSet,tOffSet;
QString defaultFont;
double defaultFontSize;
bool defaultFontBold;
QString textboxFont;
double textboxFontSize;
bool textboxFontBold;
int maxFollowUps;
bool autoClosePrintDlg;
int maxFollowUpsPerProblem;
bool autoSetnewAfterMaxPerProblemIsReached;
int checkoutDate;
int checkoutTime;
bool enableVisualEffects;
bool operator==(const pSettings& psettings) const
{
return std::tie(
speciality,
autoCompleteByWord,
showChronicConditions,
showNavArrows,
smallScreenMode,
simpleExamination,
alwaysSave,
inLinePatientList,
newVisitPrice,
followVisitprice1,
followVisitprice2,
followVisitprice3,
followVisitprice4,
autosaveinterval,
autoSave ,
minimizeToTray,
selectedTheme,
textColor,
topBGColor,
bottomBGColor,
altWinColor,
buttonColor,
altButtonColor,
textBGColor,
borderColor1,
borderColor2,
altButtonColorHover,
buttonColorHover,
buttonColorDisabled,
buttonBorderColorHover,
comboBGcolor,
buttonTextColor,
comboTextColor,
lOffSet,
tOffSet,
defaultFont,
defaultFontSize,
defaultFontBold,
textboxFont,
textboxFontSize,
textboxFontBold,
maxFollowUps,
autoClosePrintDlg,
maxFollowUpsPerProblem,
autoSetnewAfterMaxPerProblemIsReached,
checkoutDate,
checkoutTime,
enableVisualEffects) ==
std::tie(psettings.speciality,
psettings.autoCompleteByWord,
psettings.showChronicConditions,
psettings.showNavArrows,
psettings.smallScreenMode,
psettings.simpleExamination,
psettings.alwaysSave,
psettings.inLinePatientList,
psettings.newVisitPrice,
psettings.followVisitprice1,
psettings.followVisitprice2,
psettings.followVisitprice3,
psettings.followVisitprice4,
psettings.autosaveinterval,
psettings.autoSave ,
psettings.minimizeToTray,
psettings.selectedTheme,
psettings.textColor,
psettings.topBGColor,
psettings.bottomBGColor,
psettings.altWinColor,
psettings.buttonColor,
psettings.altButtonColor,
psettings.textBGColor,
psettings.borderColor1,
psettings.borderColor2,
psettings.altButtonColorHover,
psettings.buttonColorHover,
psettings.buttonColorDisabled,
psettings.buttonBorderColorHover,
psettings.comboBGcolor,
psettings.buttonTextColor,
psettings.comboTextColor,
psettings.lOffSet,
psettings.tOffSet,
psettings.defaultFont,
psettings.defaultFontSize,
psettings.defaultFontBold,
psettings.textboxFont,
psettings.textboxFontSize,
psettings.textboxFontBold,
psettings.maxFollowUps,
psettings.autoClosePrintDlg,
psettings.maxFollowUpsPerProblem,
psettings.autoSetnewAfterMaxPerProblemIsReached,
psettings.checkoutDate,
psettings.checkoutTime,
psettings.enableVisualEffects);
}
};
코드를 관련 항목에 맞게 좁힐 수 있습니까? –
@dasblinkenlight'std :: tie'는 괜찮습니다. 'tuple'을 사용하면 모든 데이터가 복사됩니다. – juanchopanza
std :: tie는 내가 사용하기 원하는 이유가 더 간단합니다 –