[Development] Regarding using C++20 ranges in Qt
Vitaly Fanaskov
vitaly.fanaskov at qt.io
Tue Jun 11 15:31:32 CEST 2019
Hello everyone!
I think, we can use range-based approach to improve a lot of things in
Qt classes interfaces. I've performed some experiments and implemented
an access to children of QObject with this approach:
https://git.qt.io/vifanask/qobject-with-ranges . All details, pros and
cons are in the readme file.
As mentioned above, this is only a proof of concept. So there are a
plenty of ways how to improve implementation. Please, look at the
examples in the test folder and share your opinion about the approach
itself, its perspective, and any suggestions you like.
The same approach might be applied for some other classes. For example,
to QString for splitting and operations like that. It looks nicer to
provide some simple functors that might be composed to a pipeline rather
than have everything in a class interface.
I hope you follow modern C++ and know a bit of ranges. If not, feel free
to explore it:
Documentation: https://en.cppreference.com/w/cpp/ranges
Experimental implementation: https://github.com/ericniebler/range-v3
--
Best Regards,
Fanaskov Vitaly
Senior Software Engineer
The Qt Company / Qt Quick and Widgets Team
More information about the Development
mailing list