Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 90606b0

Browse files
noexcept autoptr
1 parent 7a3bcbe commit 90606b0

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

‎src/common/classes/auto.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ class AutoPtr
117117
Clear<Where>::clear(ptr);
118118
}
119119

120+
// copying is prohibited
121+
AutoPtr(AutoPtr&) = delete;
122+
void operator=(AutoPtr&) = delete;
123+
120124
AutoPtr& operator= (Where* v)
121125
{
122126
Clear<Where>::clear(ptr);
@@ -135,42 +139,42 @@ class AutoPtr
135139
return *this;
136140
}
137141

138-
const Where* get() const
142+
const Where* get() constnoexcept
139143
{
140144
return ptr;
141145
}
142146

143-
operator const Where*() const
147+
operator const Where*() constnoexcept
144148
{
145149
return ptr;
146150
}
147151

148-
Where* get()
152+
Where* get()noexcept
149153
{
150154
return ptr;
151155
}
152156

153-
operator Where*()
157+
operator Where*()noexcept
154158
{
155159
return ptr;
156160
}
157161

158-
bool operator !() const
162+
bool operator !() constnoexcept
159163
{
160164
return !ptr;
161165
}
162166

163-
bool hasData() const
167+
bool hasData() constnoexcept
164168
{
165169
return ptr != NULL;
166170
}
167171

168-
Where* operator->() const
172+
Where* operator->() constnoexcept
169173
{
170174
return ptr;
171175
}
172176

173-
Where* release()
177+
Where* release()noexcept
174178
{
175179
Where* tmp = ptr;
176180
ptr = NULL;
@@ -186,9 +190,6 @@ class AutoPtr
186190
}
187191
}
188192

189-
private:
190-
AutoPtr(AutoPtr&);
191-
void operator=(AutoPtr&);
192193
};
193194

194195
template <typename T>
@@ -212,11 +213,11 @@ class AutoSaveRestore
212213
*value = oldValue;
213214
}
214215

215-
private:
216216
// copying is prohibited
217-
AutoSaveRestore(const AutoSaveRestore&);
218-
AutoSaveRestore& operator =(const AutoSaveRestore&);
217+
AutoSaveRestore(const AutoSaveRestore&) = delete;
218+
AutoSaveRestore& operator =(const AutoSaveRestore&) = delete;
219219

220+
private:
220221
T* value;
221222
T oldValue;
222223
};
@@ -260,11 +261,11 @@ class AutoSetRestoreFlag
260261
oldValue &= ~cleanBit;
261262
}
262263

263-
private:
264264
// copying is prohibited
265-
AutoSetRestoreFlag(const AutoSetRestoreFlag&);
266-
AutoSetRestoreFlag& operator =(const AutoSetRestoreFlag&);
265+
AutoSetRestoreFlag(const AutoSetRestoreFlag&) = delete;
266+
AutoSetRestoreFlag& operator =(const AutoSetRestoreFlag&) = delete;
267267

268+
private:
268269
T* value;
269270
T bit;
270271
T oldValue;
@@ -292,10 +293,9 @@ class AutoSetRestore2
292293
(pointer->*setter)(oldValue);
293294
}
294295

295-
private:
296296
// copying is prohibited
297-
AutoSetRestore2(const AutoSetRestore2&);
298-
AutoSetRestore2& operator =(const AutoSetRestore2&);
297+
AutoSetRestore2(const AutoSetRestore2&) = delete;
298+
AutoSetRestore2& operator =(const AutoSetRestore2&) = delete;
299299

300300
private:
301301
T2* pointer;
@@ -325,7 +325,7 @@ class CleanupFunction
325325
typedef void Func();
326326

327327
public:
328-
CleanupFunction(Func* clFunc)
328+
CleanupFunction(Func* clFunc)noexcept
329329
: clean(clFunc)
330330
{ }
331331

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /