I need to confirm this but is it possible to have a Ternary Operator in an if-then statement in C++ without the else?
For example:
if (ShowDebug)
{
DebugRender();
}
… would be:
ShowDebug ? DebugRender();
… but I get a:
error C2059: syntax error: ';'
… then I thought maybe I could avoid a compiler error with having the right syntax but nothing in the else part:
ShowDebug ? DebugRender():;
… and I still get a:
error C2059: syntax error: ';'
Any suggestions? Or is it simply not supported?
Source: Windows Questions C++