Ada has nice feature of and then
statement used in the if
condition in addition to the Boolean and
operator. This allows for checking if, e.g., the object is not null before accessing it like so:
if Object /= null and then Object.Value > 5 then
-- do something with the value
end if;
Is there a way to express a similar behaviour in C++ w/o using a nested if
?