summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qforeach.qdoc
blob: e6abf0e29c8896d566710740f5eecb70aca4ebbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \macro forever
    \relates <QForeach>

    This macro is provided for convenience for writing infinite
    loops.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp 31

    It is equivalent to \c{for (;;)}.

    If you're worried about namespace pollution, you can disable this
    macro by adding the following line to your \c .pro file:

    \snippet code/src_corelib_global_qglobal.cpp 32

    If using other build systems, you can add \c QT_NO_KEYWORDS to the
    list of pre-defined macros.

    \sa Q_FOREVER
*/

/*!
    \macro Q_FOREVER
    \relates <QForeach>

    Same as \l{forever}.

    This macro is available even when \c no_keywords is specified
    using the \c .pro file's \c CONFIG variable.

    \sa foreach()
*/

/*!
    \macro foreach(variable, container)
    \relates <QForeach>

    This macro is used to implement Qt's \c foreach loop. The \a
    variable parameter is a variable name or variable definition; the
    \a container parameter is a Qt container whose value type
    corresponds to the type of the variable. See \l{The foreach
    Keyword} for details.

    If you're worried about namespace pollution, you can disable this
    macro by adding the following line to your \c .pro file:

    \snippet code/src_corelib_global_qglobal.cpp 33

    \note Since Qt 5.7, the use of this macro is discouraged.
    Use C++11 range-based \c for, possibly with \c {std::as_const()},
    as needed.
*/

/*!
    \macro Q_FOREACH(variable, container)
    \relates <QForeach>

    Same as foreach(\a variable, \a container).

    This macro is available even when \c no_keywords is specified
    using the \c .pro file's \c CONFIG variable.

    \note Since Qt 5.7, the use of this macro is discouraged.
    Use C++11 range-based \c for, possibly with \c {std::as_const()},
    as needed.
*/