fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <set>
  4. #include <utility>
  5. #include <vector>
  6. #include <array>
  7. using namespace std;
  8.  
  9. int main() {
  10. const int NMAX = 3;
  11. typedef pair<int, set<int>> solution;
  12. std::array<std::array<solution, NMAX>, NMAX> memo;
  13. solution s;
  14. s.first = -1;
  15. std::for_each(std::begin(memo), std::end(memo), [&s](std::array<solution,NMAX>& next){next.fill(s);});
  16.  
  17. for (auto&& nextArr : memo)
  18. {
  19. for (auto&& nextPair : nextArr)
  20. {
  21. std::cout << nextPair.first << " ";
  22. }
  23. std::cout << endl;
  24. }
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 3100KB
stdin
Standard input is empty
stdout
-1 -1 -1 
-1 -1 -1 
-1 -1 -1