[Stanford Algorithms: Design and Analysis, Part 2] c22- Kruskal's MST


// CPP program to demonstrate use of std::map
#include <bits/stdc++.h>

int main()
{
std::shared_ptr<char> pA(new char('A'));
std::shared_ptr<char> pB(new char('B'));
std::shared_ptr<char> pC(pA);

std::cout << pC.use_count() << std::endl; //2

std::cout << *pA << std::endl;//A

pA = pB;

std::cout << *pA << std::endl;//B

std::cout << pC.use_count() << std::endl; //1

}


 

猜你喜欢

转载自www.cnblogs.com/ecoflex/p/10570087.html