Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:07:39

0001 // Copyright (C) 2022 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QTCORE_QSWAP_H
0005 #define QTCORE_QSWAP_H
0006 
0007 #include <QtCore/qtconfigmacros.h>
0008 
0009 #include <type_traits>
0010 #include <utility>
0011 
0012 #if 0
0013 #pragma qt_class(QtSwap)
0014 #pragma qt_sync_stop_processing
0015 #endif
0016 
0017 QT_BEGIN_NAMESPACE
0018 
0019 template <typename T>
0020 constexpr void qSwap(T &value1, T &value2)
0021     noexcept(std::is_nothrow_swappable_v<T>)
0022 {
0023     using std::swap;
0024     swap(value1, value2);
0025 }
0026 
0027 // pure compile-time micro-optimization for our own headers, so not documented:
0028 template <typename T>
0029 constexpr inline void qt_ptr_swap(T* &lhs, T* &rhs) noexcept
0030 {
0031     T *tmp = lhs;
0032     lhs = rhs;
0033     rhs = tmp;
0034 }
0035 
0036 QT_END_NAMESPACE
0037 
0038 #endif // QTCORE_QSWAP_H