Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:21:41

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 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QTCORE_QSWAP_H
0006 #define QTCORE_QSWAP_H
0007 
0008 #include <QtCore/qtconfigmacros.h>
0009 
0010 #include <type_traits>
0011 #include <utility>
0012 
0013 #if 0
0014 #pragma qt_class(QtSwap)
0015 #pragma qt_sync_stop_processing
0016 #endif
0017 
0018 QT_BEGIN_NAMESPACE
0019 
0020 template <typename T>
0021 constexpr void qSwap(T &value1, T &value2)
0022     noexcept(std::is_nothrow_swappable_v<T>)
0023 {
0024     using std::swap;
0025     swap(value1, value2);
0026 }
0027 
0028 // pure compile-time micro-optimization for our own headers, so not documented:
0029 template <typename T>
0030 constexpr inline void qt_ptr_swap(T* &lhs, T* &rhs) noexcept
0031 {
0032     T *tmp = lhs;
0033     lhs = rhs;
0034     rhs = tmp;
0035 }
0036 
0037 QT_END_NAMESPACE
0038 
0039 #endif // QTCORE_QSWAP_H