8#include <QtCore/qtclasshelpermacros.h>
9#include <QtCore/qtconfigmacros.h>
10#include <QtCore/qtdeprecationmarkers.h>
11#include <QtCore/qttypetraits.h>
16#pragma qt_class(QForeach)
17#pragma qt_sync_stop_processing
32 typename T::const_iterator
i,
e;
36template <typename T, typename = decltype(std::declval<T>().detach())>
39#if QT_DEPRECATED_SINCE(6, 0)
43 "Prefer using a range-based for loop with these containers: `for (const auto &it : container)`, "
44 "keeping in mind that range-based for doesn't copy the container as Q_FOREACH does")
51 warnIfContainerIsNotShared<typename std::decay<T>::type>(0);
59#define Q_FOREACH_IMPL(variable, name, container) \
60 for (auto name = QtPrivate::qMakeForeachContainer(container); name.i != name.e; ++name.i) \
61 if (variable = *name.i; false) {} else
63#define Q_FOREACH_JOIN(A, B) Q_FOREACH_JOIN_IMPL(A, B)
64#define Q_FOREACH_JOIN_IMPL(A, B) A ## B
66#define Q_FOREACH(variable, container) \
67 Q_FOREACH_IMPL(variable, Q_FOREACH_JOIN(_container_, __LINE__), container)
70#define Q_FOREVER for(;;)
74# define foreach Q_FOREACH
78# define forever Q_FOREVER
QForeachContainer(const T &t)
Combined button and popup list for selecting options.
void warnIfContainerIsNotShared(int)
QForeachContainer< typename std::decay< T >::type > qMakeForeachContainer(T &&t)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
#define QT_DEPRECATED_VERSION_X_6_0(text)