I'm just replying to this email to sumarize my opinion from the other email in the "qMoveToConst helper for rvalue references to movable Qt containers?" thread.

I do not think it is time to deprecate foreach. Currently, the documentation says it is discouraged, and that's fine. But the alternative are harder to use with Qt containers and I do not think it is wise to tell everybody to port away from foreach.

One problem of foreach is that it does not work well with QVerLenghtArray and standard containers. But in practice, Qt user are not using them so much.
But I guess it would be fine to deprecate and warn for this case:
https://codereview.qt-project.org/244010

The other problems seems really minors, and not a reason to port away from it, especially when the alternative is much more difficult to use right.

On 10/28/18 7:34 PM, Giuseppe D'Angelo via Development wrote:
[...]
Why should the Qt Project invest any resource whatsoever maintaining a solution to a problem that has also been solved by the C++ language (and in a more efficient and general way than Q_FOREACH)?

Historical reason, and for the same reason the Qt project maintains its own containers. I guess it would be good to discourage uses of QVector/QMap/QSet/...
But we can't just force everybody to move away from it just like that.

--
Olivier

Woboq - Qt services and support - https://woboq.com - https://code.woboq.org
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to