1 struct __shared_count {
2 __shared_count() { _M_pi = new int; }
8 __shared_ptr(_Tp* __p);
9 void reset(int * __p) {
10 __shared_ptr(__p).swap(*this);
12 void swap(__shared_ptr<_Tp>& __other) {
13 __other._M_refcount._M_pi = _M_refcount._M_pi;
15 __shared_count _M_refcount;
17 template<typename _Tp> class shared_ptr : public __shared_ptr<_Tp> {};
19 for (shared_ptr<int> *iter;;)
22 (iter++)->reset(new int);