… | |
… | |
107 | } |
107 | } |
108 | }; |
108 | }; |
109 | |
109 | |
110 | struct refcounted |
110 | struct refcounted |
111 | { |
111 | { |
112 | mutable int refcnt; |
|
|
113 | refcounted () : refcnt (0) { } |
112 | refcounted () : refcnt (0) { } |
|
|
113 | // virtual ~refcounted (); |
114 | void refcnt_inc () { ++refcnt; } |
114 | void refcnt_inc () { ++refcnt; } |
115 | void refcnt_dec () { --refcnt; } |
115 | void refcnt_dec () { --refcnt; } |
|
|
116 | bool dead () { return refcnt == 0; } |
|
|
117 | mutable int refcnt; |
|
|
118 | #if 0 |
|
|
119 | private: |
|
|
120 | static refcounted *rc_first; |
|
|
121 | refcounted *rc_next; |
|
|
122 | #endif |
116 | }; |
123 | }; |
117 | |
124 | |
118 | template<class T> |
125 | template<class T> |
119 | struct refptr |
126 | struct refptr |
120 | { |
127 | { |