QPair is nice, but what if I need 3 items? Should I just make a struct, or does Qt have me covered?
As QTBUG-22441 indicates, the developers have no intention of adding a Qt analog of std::tuple
. (Even though QTBUG-3283 gives us hope that it could be done, it's dated Dec'09, while the newer report, with a WONTFIX, is dated May'15). Thus, you need to fall back to std::tuple
or come up with your own data structure.
Quote from Marc Mutz:
A hypothetical QTuple wouldn't do anything differently, anyway, except drain Qt developer resources.
Moreover, the docs for Qt 5 Algorithms module state the following explicitly:
Historically, Qt used to provide functions which were direct equivalents of many STL algorithmic functions. Starting with Qt 5.0, you are instead encouraged to use directly the implementations available in the STL; most of the Qt ones have been deprecated (although they are still available to keep the old code compiling).
So using STL when programming with Qt 5 is officially encouraged, should it become a necessity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With