summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qscopeguard.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qscopeguard.h')
-rw-r--r--src/corelib/tools/qscopeguard.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/tools/qscopeguard.h b/src/corelib/tools/qscopeguard.h
index 2639b41222..9be6634cc8 100644
--- a/src/corelib/tools/qscopeguard.h
+++ b/src/corelib/tools/qscopeguard.h
@@ -13,22 +13,25 @@
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(qExchange(other.m_invoke, false))
+ , m_invoke(std::exchange(other.m_invoke, false))
{
}