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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -