fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include<memory>
  4. #include<string>
  5.  
  6. using namespace std;
  7.  
  8. class has_static_constructor
  9. {
  10. public:
  11. friend class static_constructor;
  12. static vector<int> v;
  13.  
  14.  
  15.  
  16. class static_constructor
  17. {
  18. public:
  19.  
  20. vector<int> * uptt=has_static_constructor::&v; //&v;
  21. static_constructor()
  22. {
  23. cout<<"inside static_constructor";
  24. //uptt = has_static_constructor::v;
  25. has_static_constructor::v.push_back(1);
  26. has_static_constructor::v.push_back(20);
  27. }
  28.  
  29. } ;
  30.  
  31. static std::unique_ptr<has_static_constructor::static_constructor> upt ;
  32. };
  33.  
  34.  
  35.  
  36. unique_ptr<has_static_constructor::static_constructor> has_static_constructor::upt(new has_static_constructor::static_constructor());
  37.  
  38. vector< int > has_static_constructor::v(2,100);
  39.  
  40. int main() {
  41. // your code goes here
  42.  
  43. for (std::vector<int>::const_iterator i = has_static_constructor::v.begin(); i != has_static_constructor::v.end(); ++i)
  44. { std::cout << *i << ' ';
  45. cout<<"\n I was here\n";
  46. }
  47.  
  48. return 0;
  49. }
Compilation error #stdin compilation error #stdout 0s 3460KB
stdin
Standard input is empty
compilation info
prog.cpp:20:48: error: expected unqualified-id before '&' token
     vector<int> * uptt=has_static_constructor::&v; //&v;
                                                ^
stdout
Standard output is empty