#include <iostream>
#include <memory>
int main() {
std::shared_ptr<int> p1( new int( 0 ) );
std::shared_ptr<int> p2( new int( 1 ) );
std::cout << "-----step1-----" << std::endl;
std::cout << "p1 = " << *p1 << std::endl;
std::cout << "p2 = " << *p2 << std::endl;
std::cout << std::endl << "-----step2-----" << std::endl;
std::shared_ptr<int> p3 = p1;
std::cout << "p1 = " << *p1 << std::endl;
std::cout << "p2 = " << *p2 << std::endl;
std::cout << "p3 = " << *p3 << std::endl;
std::cout << std::endl << "-----step3-----" << std::endl;
p3 = p2;
std::cout << "p1 = " << *p1 << std::endl;
std::cout << "p2 = " << *p2 << std::endl;
std::cout << "p3 = " << *p3 << std::endl;
std::cout << std::endl << "-----step4-----" << std::endl;
p1.reset();
p2.reset();
std::cout << "p1 is " << ( ( (bool)p1 ) ? "not nullptr" : "nullptr" ) << std::endl;
std::cout << "p2 is " << ( ( (bool)p2 ) ? "not nullptr" : "nullptr" ) << std::endl;
std::cout << "p3 = " << *p3 << std::endl;
return 0;
}