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
qforeach.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\headerfile <QForeach>
6
\inmodule QtCore
7
\ingroup funclists
8
\brief Helper macros for performing for-loops.
9
*/
10
11
/*!
12
\macro forever
13
\relates <QForeach>
14
15
This macro is provided for convenience for writing infinite
16
loops.
17
18
Example:
19
20
\snippet code/src_corelib_global_qglobal.cpp 31
21
22
It is equivalent to \c{for (;;)}.
23
24
If you're worried about namespace pollution, you can disable this
25
macro by adding the following line to your \c .pro file:
26
27
\snippet code/src_corelib_global_qglobal.cpp 32
28
29
If using other build systems, you can add \c QT_NO_KEYWORDS to the
30
list of pre-defined macros.
31
32
\sa Q_FOREVER
33
*/
34
35
/*!
36
\macro Q_FOREVER
37
\relates <QForeach>
38
39
Same as \l{forever}.
40
41
This macro is available even when \c no_keywords is specified
42
using the \c .pro file's \c CONFIG variable.
43
44
\sa foreach()
45
*/
46
47
/*!
48
\macro foreach(variable, container)
49
\relates <QForeach>
50
51
This macro is used to implement Qt's \c foreach loop. The \a
52
variable parameter is a variable name or variable definition; the
53
\a container parameter is a Qt container whose value type
54
corresponds to the type of the variable. See \l{The foreach
55
Keyword} for details.
56
57
If you're worried about namespace pollution, you can disable this
58
macro by adding the following line to your \c .pro file:
59
60
\snippet code/src_corelib_global_qglobal.cpp 32
61
62
\note Since Qt 5.7, the use of this macro is discouraged.
63
Use C++11 range-based \c for, possibly with \c {std::as_const()},
64
as needed.
65
*/
66
67
/*!
68
\macro Q_FOREACH(variable, container)
69
\relates <QForeach>
70
71
Same as foreach(\a variable, \a container).
72
73
This macro is available even when \c no_keywords is specified
74
using the \c .pro file's \c CONFIG variable.
75
76
\note Since Qt 5.7, the use of this macro is discouraged.
77
Use C++11 range-based \c for, possibly with \c {std::as_const()},
78
as needed.
79
*/
qtbase
src
corelib
global
qforeach.qdoc
Generated on
for Qt by
1.14.0