fork download
  1. #include <iostream>
  2. using namespace std;
  3. #ifdef _MSC_VER
  4. #define __PRETTY_FUNCTION__ __FUNCSIG__
  5. #endif
  6. class Foo
  7. {
  8. public:
  9. Foo()
  10. {
  11. cout << __PRETTY_FUNCTION__ << endl;
  12. }
  13. Foo(Foo&&)
  14. {
  15. cout << __PRETTY_FUNCTION__ << endl;
  16. }
  17. Foo(const Foo&)
  18. {
  19. cout << __PRETTY_FUNCTION__ << endl;
  20. }
  21.  
  22. };
  23. void Bar(Foo & a) {}
  24. int main() {
  25. Foo f;
  26. Foo &f2 = f;
  27. cout << "@@@@@@+" << endl;
  28. auto lambda = [f2]() /*mutable*/ {
  29. Foo foo = move(f2); // No use.
  30. Bar(foo);
  31. };
  32. cout << "@@@@@@-" << endl;
  33. lambda();
  34. // your code goes here
  35. return 0;
  36. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Foo::Foo()
@@@@@@+
Foo::Foo(const Foo&)
@@@@@@-
Foo::Foo(const Foo&)