Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qswap.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTCORE_QSWAP_H
5#define QTCORE_QSWAP_H
6
7#include <QtCore/qtconfigmacros.h>
8
9#include <type_traits>
10#include <utility>
11
12#if 0
13#pragma qt_class(QtSwap)
14#pragma qt_sync_stop_processing
15#endif
16
18
19template <typename T>
20constexpr void qSwap(T &value1, T &value2)
21 noexcept(std::is_nothrow_swappable_v<T>)
22{
23 using std::swap;
24 swap(value1, value2);
25}
26
27// pure compile-time micro-optimization for our own headers, so not documented:
28template <typename T>
29constexpr inline void qt_ptr_swap(T* &lhs, T* &rhs) noexcept
30{
31 T *tmp = lhs;
32 lhs = rhs;
33 rhs = tmp;
34}
35
37
38#endif // QTCORE_QSWAP_H
Combined button and popup list for selecting options.
void uint64_t uint64_t uint64_t value2
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
Definition qswap.h:29
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
Definition qswap.h:20
this swap(other)