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
qvolatile_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
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 QVOLATILE_P_H
5#define QVOLATILE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of a number of Qt sources files. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qglobal_p.h>
19
21
22namespace QtPrivate {
23template <typename T>
24using if_volatile = std::enable_if_t<std::is_volatile_v<T>, bool>;
25
26//
27// C++20-deprecated volatile compound operations, rewritten as separated operations
28//
29
30// these functions return `auto`, not `T`, to strip cv-qualifiers without having
31// to mention the `volatile` keyword
32
33template <typename T, QtPrivate::if_volatile<T> = true>
35 auto y = x;
36 ++y;
37 x = y;
38 return y;
39}
40
41template <typename T, QtPrivate::if_volatile<T> = true>
43{
44 auto y = x;
45 --y;
46 x = y;
47 return y;
48}
49} // namespace QtPrivate
50
52
53#endif // QVOLATILE_H
Combined button and popup list for selecting options.
\macro QT_NO_KEYWORDS >
auto volatilePreDecrement(T &x)
Definition qvolatile_p.h:42
std::enable_if_t< std::is_volatile_v< T >, bool > if_volatile
Definition qvolatile_p.h:24
auto volatilePreIncrement(T &x)
Definition qvolatile_p.h:34
GLint GLint GLint GLint GLint x
[0]
GLint y