Skip to content

Commit a81b6ea

Browse files
committed
remove all m_ adornement - rename invoke_checker member to invoke_check_func
1 parent 59baf8c commit a81b6ea

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

include/beman/scope/scope.hpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class [[nodiscard]] scope_guard<ScopeExitFunc, InvokeChecker, ConstructionExcept
227227
constexpr scope_guard(EF&& exit_func,
228228
CHKR&& invoke_checker) noexcept(std::is_nothrow_constructible_v<ScopeExitFunc> &&
229229
std::is_nothrow_constructible_v<InvokeChecker>) try
230-
: m_exit_func{std::forward<EF>(exit_func)}, m_invoke_checker{std::forward<CHKR>(invoke_checker)} {
230+
: exit_func{std::forward<EF>(exit_func)}, invoke_check_func{std::forward<CHKR>(invoke_checker)} {
231231
} catch (...) {
232232
if constexpr (ConstructionExceptionBehavior == exception_during_construction_behaviour::invoke_exit_func) {
233233
exit_func();
@@ -241,7 +241,7 @@ class [[nodiscard]] scope_guard<ScopeExitFunc, InvokeChecker, ConstructionExcept
241241
explicit constexpr scope_guard(EF&& exit_func) noexcept(std::is_nothrow_constructible_v<ScopeExitFunc> &&
242242
std::is_nothrow_constructible_v<InvokeChecker>)
243243
requires(std::is_default_constructible_v<InvokeChecker> && !std::is_same_v<std::remove_cvref<EF>, scope_guard>)
244-
try : m_exit_func{std::forward<EF>(exit_func)} {
244+
try : exit_func{std::forward<EF>(exit_func)} {
245245
} catch (...) {
246246
if constexpr (ConstructionExceptionBehavior == exception_during_construction_behaviour::invoke_exit_func) {
247247
exit_func();
@@ -254,7 +254,7 @@ class [[nodiscard]] scope_guard<ScopeExitFunc, InvokeChecker, ConstructionExcept
254254
constexpr scope_guard(scope_guard&& rhs) noexcept(std::is_nothrow_move_constructible_v<ScopeExitFunc> &&
255255
std::is_nothrow_move_constructible_v<InvokeChecker>)
256256
requires(HasRelease<InvokeChecker> || HasStaticRelease<InvokeChecker>)
257-
: m_exit_func{std::move(rhs.m_exit_func)}, m_invoke_checker{std::move(rhs.m_invoke_checker)} {
257+
: exit_func{std::move(rhs.exit_func)}, invoke_check_func{std::move(rhs.invoke_check_func)} {
258258
// TODO: This does not work corectly for a shared invoke checker
259259
// After a move will disable all.
260260

@@ -269,28 +269,28 @@ class [[nodiscard]] scope_guard<ScopeExitFunc, InvokeChecker, ConstructionExcept
269269
scope_guard& operator=(const scope_guard&) = delete;
270270
scope_guard& operator=(scope_guard&& rhs) = delete;
271271

272-
constexpr ~scope_guard() noexcept(noexcept(m_exit_func()) && noexcept(m_invoke_checker())) {
273-
if (m_invoke_checker()) {
274-
m_exit_func();
272+
constexpr ~scope_guard() noexcept(noexcept(exit_func()) && noexcept(invoke_check_func())) {
273+
if (invoke_check_func()) {
274+
exit_func();
275275
}
276276
}
277277

278-
InvokeChecker& invoke_checker() & noexcept { return m_invoke_checker; }
278+
InvokeChecker& invoke_checker() & noexcept { return invoke_checker; }
279279

280280
constexpr void release() noexcept
281281
// Shouldn't this "noexcept" be dependent on the noexcept of the release function? how??
282282
requires(HasRelease<InvokeChecker> || HasStaticRelease<InvokeChecker>)
283283
{
284284
if constexpr (HasRelease<InvokeChecker>) {
285-
m_invoke_checker.release();
285+
invoke_check_func.release();
286286
} else {
287287
InvokeChecker::release();
288288
}
289289
}
290290

291291
private:
292-
ScopeExitFunc m_exit_func;
293-
InvokeChecker m_invoke_checker;
292+
ScopeExitFunc exit_func;
293+
InvokeChecker invoke_check_func;
294294
};
295295

296296
//======
@@ -299,13 +299,13 @@ class [[nodiscard]] scope_guard<ScopeExitFunc, InvokeChecker, ConstructionExcept
299299

300300
template <scope_exit_function ScopeExitFunc>
301301
class [[nodiscard]] scope_guard<ScopeExitFunc, void, exception_during_construction_behaviour::invoke_exit_func> {
302-
ScopeExitFunc m_exit_func;
302+
ScopeExitFunc exit_func;
303303

304304
public:
305305
template <typename T>
306306
explicit constexpr scope_guard(T&& exit_func) noexcept(std::is_nothrow_constructible_v<ScopeExitFunc>)
307307
requires(!std::is_same_v<std::remove_cvref<T>, scope_guard>)
308-
try : m_exit_func(std::forward<T>(exit_func)) {
308+
try : exit_func(std::forward<T>(exit_func)) {
309309
} catch (...) {
310310
exit_func();
311311

@@ -317,27 +317,27 @@ class [[nodiscard]] scope_guard<ScopeExitFunc, void, exception_during_constructi
317317
scope_guard& operator=(const scope_guard&) = delete;
318318
scope_guard& operator=(scope_guard&&) = delete;
319319

320-
constexpr ~scope_guard() noexcept(noexcept(m_exit_func())) { m_exit_func(); }
320+
constexpr ~scope_guard() noexcept(noexcept(exit_func())) { exit_func(); }
321321
};
322322

323323
//======
324324

325325
template <scope_exit_function ScopeExitFunc>
326326
class [[nodiscard]] scope_guard<ScopeExitFunc, void, exception_during_construction_behaviour::dont_invoke_exit_func> {
327-
ScopeExitFunc m_exit_func;
327+
ScopeExitFunc exit_func;
328328

329329
public:
330330
template <typename T>
331331
explicit constexpr scope_guard(T&& exit_func) noexcept(std::is_nothrow_constructible_v<ScopeExitFunc>)
332332
requires(!std::is_same_v<std::remove_cvref<T>, scope_guard>)
333-
: m_exit_func(std::forward<T>(exit_func)) {}
333+
: exit_func(std::forward<T>(exit_func)) {}
334334

335335
scope_guard(const scope_guard&) = delete;
336336
scope_guard(scope_guard&&) = delete;
337337
scope_guard& operator=(const scope_guard&) = delete;
338338
scope_guard& operator=(scope_guard&&) = delete;
339339

340-
constexpr ~scope_guard() noexcept(noexcept(m_exit_func())) { m_exit_func(); }
340+
constexpr ~scope_guard() noexcept(noexcept(exit_func())) { exit_func(); }
341341
};
342342

343343
//==================================================================================================
@@ -361,12 +361,12 @@ scope_guard(ExitFunc&&) -> scope_guard<std::decay_t<ExitFunc>, InvokeChecker, ec
361361

362362
class Releaser {
363363
public:
364-
bool operator()() const { return m_can_invoke; }
364+
bool operator()() const { return can_invoke; }
365365

366-
void release() { m_can_invoke = false; }
366+
void release() { can_invoke = false; }
367367

368368
private:
369-
bool m_can_invoke = true;
369+
bool can_invoke = true;
370370
};
371371

372372
//======
@@ -376,27 +376,27 @@ class ReleasableExecuteWhenNoException {
376376
using DontInvokeOnCreationException = void;
377377

378378
[[nodiscard]] bool operator()() const noexcept(noexcept(std::uncaught_exceptions())) {
379-
return m_uncaught_on_creation >= std::uncaught_exceptions();
379+
return uncaught_on_creation >= std::uncaught_exceptions();
380380
}
381381

382-
void release() { m_uncaught_on_creation = std::numeric_limits<int>::min(); }
382+
void release() { uncaught_on_creation = std::numeric_limits<int>::min(); }
383383

384384
private:
385-
int m_uncaught_on_creation = std::uncaught_exceptions();
385+
int uncaught_on_creation = std::uncaught_exceptions();
386386
};
387387

388388
//======
389389

390390
class ReleasableExecuteOnlyWhenException {
391391
public:
392392
[[nodiscard]] bool operator()() const noexcept(noexcept(std::uncaught_exceptions())) {
393-
return m_uncaught_on_creation < std::uncaught_exceptions();
393+
return uncaught_on_creation < std::uncaught_exceptions();
394394
}
395395

396-
void release() { m_uncaught_on_creation = std::numeric_limits<int>::max(); }
396+
void release() { uncaught_on_creation = std::numeric_limits<int>::max(); }
397397

398398
private:
399-
int m_uncaught_on_creation = std::uncaught_exceptions();
399+
int uncaught_on_creation = std::uncaught_exceptions();
400400
};
401401

402402
//==================================================================================================

0 commit comments

Comments
 (0)