diff options
Diffstat (limited to 'src/corelib/tools/qscopeguard.h')
-rw-r--r-- | src/corelib/tools/qscopeguard.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/tools/qscopeguard.h b/src/corelib/tools/qscopeguard.h index 5bd202ce33..9be6634cc8 100644 --- a/src/corelib/tools/qscopeguard.h +++ b/src/corelib/tools/qscopeguard.h @@ -13,19 +13,22 @@ QT_BEGIN_NAMESPACE template <typename F> -class [[nodiscard]] QScopeGuard +class QScopeGuard { public: + Q_NODISCARD_CTOR explicit QScopeGuard(F &&f) noexcept : m_func(std::move(f)) { } + Q_NODISCARD_CTOR explicit QScopeGuard(const F &f) noexcept : m_func(f) { } + Q_NODISCARD_CTOR QScopeGuard(QScopeGuard &&other) noexcept : m_func(std::move(other.m_func)) , m_invoke(std::exchange(other.m_invoke, false)) |