make use of Q_TYPEOF() in compat Q_FOREACH()

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2020-01-02 16:55:26 +00:00
parent 7f5237aaed
commit 61e0a23d43

View file

@ -1199,7 +1199,7 @@ typedef uint Flags;
#endif /* Q_NO_TYPESAFE_FLAGS */ #endif /* Q_NO_TYPESAFE_FLAGS */
#if (defined(Q_CC_GNU) || defined(Q_CC_CLANG)) && defined(QT_FOREACH_COMPAT) #ifdef QT_FOREACH_COMPAT
template <typename T> template <typename T>
class QForeachContainer { class QForeachContainer {
public: public:
@ -1211,13 +1211,13 @@ private:
}; };
#define Q_FOREACH(variable, container) \ #define Q_FOREACH(variable, container) \
for (variable: QForeachContainer<__typeof__(container)>(container)) for (variable: QForeachContainer<Q_TYPEOF(container)>(container))
#else #else
#define Q_FOREACH(variable, container) for (variable: container) #define Q_FOREACH(variable, container) for (variable: container)
#endif #endif // QT_FOREACH_COMPAT
#define Q_FOREVER for(;;) #define Q_FOREVER for(;;)
#ifndef QT_NO_KEYWORDS #ifndef QT_NO_KEYWORDS