Probably a very simple question but I'm interested in what options there are. I have three conditions each of which should produce a different output
// special cases
if(!A && B)
return -1;
if(A && !B)
return 1;
if(!A && !B)
return 0;
// general case
return someOtherFunction(x, y);
Which I can get down to -
if(!A) {
if(!B)
return 0;
return -1;
}
if(A && !B)
return 1;
return someOtherFunction(x, y);
Can I simplify this further? This is in C++ so I am limited to using language specific operators and functions (including STL) etc.