[Interest] Qt containers deprecated with 5.0?

Konstantin Tokarev annulen at yandex.ru
Sun Nov 27 19:17:44 CET 2016



27.11.2016, 20:32, "Bob Hood" <bhood2 at comcast.net>:
> This is probably common knowledge, but I came across the following paragraph
> sited in a stackoverflow answer[1] from a page regarding Qt algorithms[2]:
>
> "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)."
>
> The responder then summarizes:
>
> "So using STL when programming with Qt 5 is officially encouraged, should it
> become a necessity."
>
> The original poster was asking about tuples, but the responder sites Qt
> algorithms. My question is: Were Qt containers also deprecated along with Qt
> algorithms starting with Qt 5.0?

No. However, it is not possible to build Qt 5 with a compiler which lacks STL
support, so at least there is no reason to avoid using STL containers which were
never implemented in Qt, like std::tuple, std::deque, or std::priority_queue.

> Or put another way, should new code based on
> the Qt5 series avoid using Qt-specific containers now?

YMMV, however if you are using C++11 or newer standard, standard containers have
additional benefit of providing emplace methods.

>
> [1]
> https://stackoverflow.com/questions/35525588/is-there-a-qpair-class-but-for-three-items-instead-of-two
> [2] https://doc.qt.io/qt-5/qtalgorithms.html#qt-and-the-stl-algorithms
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
Regards,
Konstantin



More information about the Interest mailing list