c++ - What does ?: mean -
this question has answer here:
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
Post a Comment