fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Widget {
  5. Widget(int) { cout << "ctor" << endl; }
  6. };
  7.  
  8. struct Gadget {
  9. Gadget(const int&) { cout << "ctor" << endl; }
  10. Gadget(int&&) { cout << "ctor" << endl; }
  11. };
  12.  
  13. int main() {
  14. int x = 5;
  15. Widget{x};
  16. Widget{10};
  17. Gadget{x};
  18. Gadget{10};
  19. return 0;
  20. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
ctor
ctor
ctor
ctor