Is it possible to write your own conditional statements or overload current ones? (Like the if short hand – ?)
I have done some research and can’t find anything. Something I have in mind:
do
{
//Run Application
}if(...)//Only If variables are initialised
If this is possible, how would I go about doing so in c++?
would translate to
So why not just do that?
It’s not possible to create new operators, and it’s not possible to overload the ternary operator
?:.You could mess around with the preprocessor, but you’ll end up having less clear code than just using a regular
if.and call it like:
but personally, I’d hate to see this in production code.