#include <memory>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	shared_ptr<string> p = make_shared<string>("a");
	cout << "p use_count:" << p.use_count() << endl;
	string *p1 = p.get();
	cout << "*p:" << *p << ",*p1:" << *p1 << endl;
	cout << "p use_count:" << p.use_count() << endl;
	auto p2 = p;
	cout << "p use_count:" << p.use_count() << endl;
	shared_ptr<string> p3(p);
	cout << "p use_count:" << p.use_count() << endl;
	shared_ptr<string> p4 = make_shared<string>("b");
	p3 = p4;
	cout << "p use_count:" << p.use_count() << endl;
	p2.~shared_ptr();//...
	cout << "p use_count:" << p.use_count() << endl;
	if(p.unique()){
		cout << "p is unique";
	}
}

p use_count:1
*p:a,*p1:a
p use_count:1
p use_count:2
p use_count:3
p use_count:2
p use_count:1
p is unique