fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. #include <algorithm>
  5. #include <functional>
  6. using namespace std;
  7.  
  8. int main() {
  9. map<int,vector<int> > myMap;
  10. vector<int> x = {1,2,3,4,5};
  11. myMap[1] = x;
  12. myMap[2] = x;
  13. auto res = accumulate(myMap.begin(), myMap.end(), (size_t)0,
  14. [](size_t prior, const pair<int,vector<int> >& p) -> size_t {
  15. return prior + p.second.size();
  16. }
  17. );
  18. cout << res << endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
10