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

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -