fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <iterator>
  4.  
  5. int main() {
  6. int array [] = { 1, 1, 1, 1 };
  7.  
  8. bool allAreOne = std::all_of (std::begin (array), std::end (array), [](auto x) { return x == 1; });
  9.  
  10. std::cout << std::boolalpha << allAreOne << std::endl;
  11.  
  12. return 0;
  13. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
true