I'm getting the 'switch in protected scope error' with this code. It's a vaguely similar problem to some others on this site, however I am am not initialising variables within a case, and adding braces makes no difference.
switch (switchval){
case 1:
sort(opsThatCanWork.begin(), opsThatCanWork.end(), sortByDurationLow); //chooses op with smallest duration
break;
case 2:
sort(opsThatCanWork.begin(), opsThatCanWork.end(), sortByDurationHigh); //chooses op with biggest duration
break;
case 3:
//chooses op with lowest total job time remaining - need to calculate these
sort(opsThatCanWork.begin(), opsThatCanWork.end(), sortByRemainingJobTimeLow);
break;
case 4:
//chooses op with lowest total job time remaining - need to calculate these
sort(opsThatCanWork.begin(), opsThatCanWork.end(), sortByRemainingJobTimeHigh);
break;
case 5:
//this chooses randomly!
int randVal = round(randomGen(-0.49999, opsThatCanWork.size()-1+0.49999));
opsThatCanWork.at(0) = opsThatCanWork.at(randVal);
break;
case 6:
//first in the quene for a machine
sort(opsThatCanWork.begin(), opsThatCanWork.end(), sortByStartTimeLow);
break;
case 7:
sort(opsThatCanWork.begin(), opsThatCanWork.end(), sortByStartTimeHigh);
break;
}
the error is on the lines that state 'case 6' and 'case 7'