… | |
… | |
4 | #include <new> |
4 | #include <new> |
5 | #include <stdlib.h> |
5 | #include <stdlib.h> |
6 | #include <string.h> |
6 | #include <string.h> |
7 | #include "ecb.h" |
7 | #include "ecb.h" |
8 | #include "estl.h" |
8 | #include "estl.h" |
|
|
9 | |
|
|
10 | #include "emman.h" |
9 | |
11 | |
10 | // increases code size unless -fno-enforce-eh-specs |
12 | // increases code size unless -fno-enforce-eh-specs |
11 | #if __GNUC__ |
13 | #if __GNUC__ |
12 | # define NOTHROW |
14 | # define NOTHROW |
13 | # define THROW(x) |
15 | # define THROW(x) |
… | |
… | |
108 | auto_ptr () : p (0) { } |
110 | auto_ptr () : p (0) { } |
109 | |
111 | |
110 | explicit |
112 | explicit |
111 | auto_ptr (T *a) : p (a) { } |
113 | auto_ptr (T *a) : p (a) { } |
112 | |
114 | |
113 | auto_ptr (auto_ptr<T> &a) |
115 | auto_ptr (auto_ptr &a) |
114 | { |
116 | { |
115 | p = a.p; |
117 | p = a.p; |
116 | a.p = 0; |
118 | a.p = 0; |
117 | } |
119 | } |
118 | |
120 | |
… | |
… | |
135 | } |
137 | } |
136 | |
138 | |
137 | // void because it makes sense in our context |
139 | // void because it makes sense in our context |
138 | void operator =(auto_ptr &a) |
140 | void operator =(auto_ptr &a) |
139 | { |
141 | { |
140 | *this = a.p; |
142 | reset (a.release ()); |
141 | a.p = 0; |
|
|
142 | } |
143 | } |
143 | |
144 | |
144 | template<typename A> |
145 | template<typename A> |
145 | void operator =(auto_ptr<A> &a) |
146 | void operator =(auto_ptr<A> &a) |
146 | { |
147 | { |
147 | *this = a.p; |
148 | reset (a.release ()); |
148 | a.p = 0; |
|
|
149 | } |
149 | } |
150 | |
150 | |
151 | T *operator ->() const { return p; } |
151 | T *operator ->() const { return p; } |
152 | T &operator *() const { return *p; } |
152 | T &operator *() const { return *p; } |
153 | |
153 | |