I am...
Heres a sample of what I am doing:
std::vector<std::string DisplayIDList, DisplayNameList,
DisplaySerialNumList, LastCalibrationList,
ChromaticityXList, ChromaticityYList,
LuminanceList, ;
totalCalibDateDisplays = LastCalibrationList.size();
totalChromXDisplays = ChromaticityXList.size();
totalChromYDisplays = ChromaticityYList.size();
totalLumDisplays = LuminanceList.size();
if( totalCalibDateDisplays == totalChromXDisplays &&
totalCalibDateDisplays == totalChromXDisplays
&& totalCalibDateDisplays == totalChromYDisplays &&
totalCalibDateDisplays == totalLumDisplays)
match = true;
else
match = false;
On 12/18/06 5:57 PM, in article
4u*************@mid.individual.net, "Alf P.
Steinbach" <al***@start.nowrote:
* sideburn:
>I have a question about the best, cleanest tightest coolest way to verify
that multiple variables all contain the same value.
Lets say I have 5 variables:
Int a,b,c,d,e;
And I assign values to them:
a=4;
b=4;
c=5;
d=4;
e=4;
Then I do a test
If(a == b && a == c && a == d && a == e)
result = -1; //failed, values donąt match
else
result = 1; //passed, all variables match
This would work but its kind of messy code. In my case I have lots of
variables (they are actually string sizes as in myString.size() )
What I want to do is if all string sizes are not the same then I return an
error.
Isn't there a way to do this by mashing the bits together or something? Or
some way other than the way I describe above?
Why don't you use a std::vector rather than individually named variables.