fork(1) download
  1. #include <iostream>
  2. #include <cstring>
  3. #include <vector>
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. using namespace std;
  8.  
  9.  
  10. class A {
  11. public:
  12. int n;
  13. A(const char* p) { n = (int)strlen(p); };
  14. };
  15. void F(vector<pair<const char*, const A&> > v) {
  16. printf("F\n");
  17. for(vector<pair<const char*, const A&> >::iterator it = v.begin();it!=v.end();++it) printf(" '%s': %p %i\n", it->first, &it->second, it->second.n);
  18. };
  19.  
  20. void G(vector<pair<const char*, const A> > v) {
  21. printf("G\n");
  22. for(vector<pair<const char*, const A> >::iterator it = v.begin();it!=v.end();++it) printf(" '%s': %p %i\n", it->first, &it->second, it->second.n);
  23. };
  24.  
  25. int main(int, char**) {
  26. F({
  27. { "A", "A" },
  28. { "B", "BB" },
  29. { "C", "CCC" },
  30. { "D", "DDDD" }
  31. });
  32.  
  33. G({
  34. { "A", "A" },
  35. { "B", "BB" },
  36. { "C", "CCC" },
  37. { "D", "DDDD" }
  38. });
  39.  
  40. return 0;
  41. };
  42.  
  43.  
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
F
  'A': 0xbfaf0734 -1215553504
  'B': 0xbfaf0738 6
  'C': 0xbfaf073c -1218388432
  'D': 0xbfaf0740 -1215683500
G
  'A': 0x9f7d00c 1
  'B': 0x9f7d014 2
  'C': 0x9f7d01c 3
  'D': 0x9f7d024 4