@@ -117,6 +117,10 @@ class AutoPtr
117
117
Clear<Where>::clear (ptr);
118
118
}
119
119
120
+ // copying is prohibited
121
+ AutoPtr (AutoPtr&) = delete ;
122
+ void operator =(AutoPtr&) = delete ;
123
+
120
124
AutoPtr& operator = (Where* v)
121
125
{
122
126
Clear<Where>::clear (ptr);
@@ -135,42 +139,42 @@ class AutoPtr
135
139
return *this ;
136
140
}
137
141
138
- const Where* get () const
142
+ const Where* get () const noexcept
139
143
{
140
144
return ptr;
141
145
}
142
146
143
- operator const Where*() const
147
+ operator const Where*() const noexcept
144
148
{
145
149
return ptr;
146
150
}
147
151
148
- Where* get ()
152
+ Where* get ()noexcept
149
153
{
150
154
return ptr;
151
155
}
152
156
153
- operator Where*()
157
+ operator Where*()noexcept
154
158
{
155
159
return ptr;
156
160
}
157
161
158
- bool operator !() const
162
+ bool operator !() const noexcept
159
163
{
160
164
return !ptr;
161
165
}
162
166
163
- bool hasData () const
167
+ bool hasData () const noexcept
164
168
{
165
169
return ptr != NULL ;
166
170
}
167
171
168
- Where* operator ->() const
172
+ Where* operator ->() const noexcept
169
173
{
170
174
return ptr;
171
175
}
172
176
173
- Where* release ()
177
+ Where* release ()noexcept
174
178
{
175
179
Where* tmp = ptr;
176
180
ptr = NULL ;
@@ -186,9 +190,6 @@ class AutoPtr
186
190
}
187
191
}
188
192
189
- private:
190
- AutoPtr (AutoPtr&);
191
- void operator =(AutoPtr&);
192
193
};
193
194
194
195
template <typename T>
@@ -212,11 +213,11 @@ class AutoSaveRestore
212
213
*value = oldValue;
213
214
}
214
215
215
- private:
216
216
// copying is prohibited
217
- AutoSaveRestore (const AutoSaveRestore&);
218
- AutoSaveRestore& operator =(const AutoSaveRestore&);
217
+ AutoSaveRestore (const AutoSaveRestore&) = delete ;
218
+ AutoSaveRestore& operator =(const AutoSaveRestore&) = delete ;
219
219
220
+ private:
220
221
T* value;
221
222
T oldValue;
222
223
};
@@ -260,11 +261,11 @@ class AutoSetRestoreFlag
260
261
oldValue &= ~cleanBit;
261
262
}
262
263
263
- private:
264
264
// copying is prohibited
265
- AutoSetRestoreFlag (const AutoSetRestoreFlag&);
266
- AutoSetRestoreFlag& operator =(const AutoSetRestoreFlag&);
265
+ AutoSetRestoreFlag (const AutoSetRestoreFlag&) = delete ;
266
+ AutoSetRestoreFlag& operator =(const AutoSetRestoreFlag&) = delete ;
267
267
268
+ private:
268
269
T* value;
269
270
T bit;
270
271
T oldValue;
@@ -292,10 +293,9 @@ class AutoSetRestore2
292
293
(pointer->*setter)(oldValue);
293
294
}
294
295
295
- private:
296
296
// copying is prohibited
297
- AutoSetRestore2 (const AutoSetRestore2&);
298
- AutoSetRestore2& operator =(const AutoSetRestore2&);
297
+ AutoSetRestore2 (const AutoSetRestore2&) = delete ;
298
+ AutoSetRestore2& operator =(const AutoSetRestore2&) = delete ;
299
299
300
300
private:
301
301
T2* pointer;
@@ -325,7 +325,7 @@ class CleanupFunction
325
325
typedef void Func ();
326
326
327
327
public:
328
- CleanupFunction (Func* clFunc)
328
+ CleanupFunction (Func* clFunc)noexcept
329
329
: clean(clFunc)
330
330
{ }
331
331
0 commit comments