What does this line of code do?

I'm trying to figure out what the below line of code is doing?

1
2
3
 AvlNode *oldNode = t;
 t = (t->left != nullptr) ? t->left : t->right; //Specifically this line
 delete oldNode;
It seems to be switching the branch nodes of the node 't', but that's just a guess as I'm unfamiliar with the syntax (I guess that's what you're asking about).
It's a concise way of writing an 'if' statement, it has a similar effect to

1
2
3
4
if (t->left != nullptr) 
    t = t->left;
else
    t = t->right;

see Conditional ternary operator on this tutorial page:
http://www.cplusplus.com/doc/tutorial/operators/
Thanks for the help!
Topic archived. No new replies allowed.