The conditional operator has lower precedence than ==. Hence the line is parsed as:
auto result = (value == bool_value ) ? result_if_bool_value: result_if_not_bool_value
It is the usual
( condition ) ? expr_true : expr_false
In general the conditional operator is not equivalent to an if, but you get the same result with
T result; // auto does not work here !! if ( value == bool_value ) result = result_if_bool_value; else result = result_if_not_bool_value;
or if you want to keep auto:
auto result = result_if_not_bool_value; if (value == bool_value) result = result_if_bool_value;
Though, depending on the actual types involved this might do something entirely different than the original (result_if_not_bool_value is here evaluated independent of the condition and there is one initialization and potentially one assignment compared to only initialization. I could swap result_if_not_bool_value with result_if_bool_value, but then the condition would need to be negated which in all generality might result in different result. Though this is all just being super defensive, when the types involved behave "normal", it is mainly a matter of style.)