fork download
  1. #include <iostream>
  2. #include <memory>
  3.  
  4. using namespace std;
  5.  
  6. class A {
  7. public:
  8. A() {
  9. cout << "Default constructor" << endl;
  10. }
  11.  
  12. A( const A& a ) {
  13. cout << "Copy constructor" << endl;
  14. }
  15.  
  16. ~A() {}
  17. };
  18.  
  19. void foo( std::shared_ptr< A > a )
  20. {
  21. auto b = a;
  22. }
  23.  
  24. int main() {
  25.  
  26. foo( std::shared_ptr< A >( new A() ) );
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
Default constructor