They are converted to bool in bool context. Outside of that you have to force it.
int countNonZero = 0;
for (int i = 0; i < values.size(); ++i) {
countNonZero += !!values[i];
}
Also c++ has explicit operator bool();edit: not a great example as values[1] >0 would be better.