c++ - What does ?: mean -


given vector<int>& picked, line of code do?

 int smallest = picked.empty() ? 0 : picked.back() + 1; 

it's ternary if statement.

same as:

int smallest = if(picked.empty() == true){ return 0;}else{picked.back()+1;} 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -