diff options
Diffstat (limited to 'nihil.guard/guard.ccm')
| -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) |
