diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-06-30 07:51:23 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-06-30 07:51:23 +0100 |
| commit | 034cd404a129103a8dd7747e6bd00ffd5550da93 (patch) | |
| tree | d27946517d4d9333abd26ac50bbd4a436093e2ce /nihil.guard | |
| parent | 3e7902f7d790a486d3d9cb978df193f07f3a6ad9 (diff) | |
| download | nihil-034cd404a129103a8dd7747e6bd00ffd5550da93.tar.gz nihil-034cd404a129103a8dd7747e6bd00ffd5550da93.tar.bz2 | |
refactoring
Diffstat (limited to 'nihil.guard')
| -rw-r--r-- | nihil.guard/guard.ccm | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/nihil.guard/guard.ccm b/nihil.guard/guard.ccm index 7b6cf66..84ff401 100644 --- a/nihil.guard/guard.ccm +++ b/nihil.guard/guard.ccm @@ -1,7 +1,4 @@ -/* - * This source code is released into the public domain. - */ - +// This source code is released into the public domain. module; #include <concepts> @@ -13,19 +10,15 @@ export module nihil.guard; namespace nihil { -/* - * guard: invoke a callable when this object is destroyed; this is similar to - * scope_exit from the library fundamentals TS, which LLVM doesn't implement. - */ +// guard: invoke a callable when this object is destroyed; this is similar to +// scope_exit from the library fundamentals TS, which LLVM doesn't implement. export template<std::invocable F> struct guard final { // Initialise the guard with a callable we will invoke later. - guard(F func) : m_func(std::move(func)) {} + explicit guard(F func) : m_func(std::move(func)) {} - /* - * We are being destroyed, so call the callable. - * If the callable throws, std::terminate() will be called. - */ + // We are being destroyed, so call the callable. + // If the callable throws, std::terminate() will be called. ~guard() { if (m_func) |
