Solved Bool Qlist check if every item in list is true
-
hi
i have a list of boolQList<bool> check;
how can i check all items is true?
-
I'd go with std::all_of.
-
@ARASHz4 usually by iterating over your list and checking.
luckilyfor you, QList has a predefined function that will do exactly what you want it to, without doing anyting yourself.
bool QList::contains(const T &value) const
QList<bool> check; bool alltrue = !check.contains(false);
-
std::all_of(check.constBegin(),check.constEnd(),[](bool val){return val;});