Debian Codegraph @

yo/stl/examples/sharedptr.cc

raw
1 #include <memory>
2 #include <iostream>
3 using namespace std;
4
5 using si = shared_ptr<int>;
6 int main()
7 {
8 si ip(new int(12));
9
10 cout << ip.unique() << '\n';
11
12 si ip2(ip);
13
14 cout << ip.unique() << '\n';
15
16 si ip3 = ip;
17 si ip4;
18 cout << *ip << ip.use_count() << '\n';
19 }