diff options
Diffstat (limited to 'src/corelib/tools/qpair.h')
-rw-r--r-- | src/corelib/tools/qpair.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h index ae33d598d4..a9f6525479 100644 --- a/src/corelib/tools/qpair.h +++ b/src/corelib/tools/qpair.h @@ -62,10 +62,22 @@ struct QPair { first = std::move(p.first); second = std::move(p.second); return *this; } #endif + Q_DECL_RELAXED_CONSTEXPR void swap(QPair &other) + Q_DECL_NOEXCEPT_EXPR(noexcept(qSwap(other.first, other.first)) && noexcept(qSwap(other.second, other.second))) + { + // use qSwap() to pick up ADL swaps automatically: + qSwap(first, other.first); + qSwap(second, other.second); + } + T1 first; T2 second; }; +template <typename T1, typename T2> +void swap(QPair<T1, T2> &lhs, QPair<T1, T2> &rhs) Q_DECL_NOEXCEPT_EXPR(noexcept(lhs.swap(rhs))) +{ lhs.swap(rhs); } + // mark QPair<T1,T2> as complex/movable/primitive depending on the // typeinfos of the constituents: template<class T1, class T2> |