Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QTCORE_QSWAP_H
6
#
define
QTCORE_QSWAP_H
7
8
#
include
<
QtCore
/
qtconfigmacros
.
h
>
9
10
#
include
<
type_traits
>
11
#
include
<
utility
>
12
13
#
if
0
14
#
pragma
qt_class
(
QtSwap
)
15
#
pragma
qt_sync_stop_processing
16
#
endif
17
18
QT_BEGIN_NAMESPACE
19
20
template
<
typename
T>
21
constexpr
void
qSwap(T &value1, T &value2)
22
noexcept
(std::is_nothrow_swappable_v<T>)
23
{
24
using
std::swap;
25
swap(value1, value2);
26
}
27
28
// pure compile-time micro-optimization for our own headers, so not documented:
29
template
<
typename
T>
30
constexpr
inline
void
qt_ptr_swap
(T* &lhs, T* &rhs)
noexcept
31
{
32
T *tmp = lhs;
33
lhs = rhs;
34
rhs = tmp;
35
}
36
37
QT_END_NAMESPACE
38
39
#
endif
// QTCORE_QSWAP_H
qt_ptr_swap
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
Definition
qswap.h:30
qtbase
src
corelib
global
qswap.h
Generated on
for Qt by
1.16.1