Basic Qt containers

Most of the Qt containers are roughly equivalent to some STL containers, as shown in the next table:

 

The implementation of the basic containers is similar to that of the standard library: QLinkedList is a doubly linked list, QMap is a red-black tree (although in Qt 4 it used a skip-list implementation), QHash uses bucket chaining, and QVector uses a double-the-space reallocation strategy.

The difference is that they are all implicitly shared. Another difference is their comparatively limited functionality, having among other things a lack of exception guarantees and a lack of support for custom allocators. So, you cannot use the stack or pool allocators we discussed previously in Chapter 3, Deep Dive into C++ and Performance, with them. Also the new STL APIs from C++11 up to C++17, such as all the emplace() methods, aren't available. Even some C++98 APIs are missing, for example those for range construction and insertion.

The containers shown in the previous table can all be paired with a correspondent STL container. However, there are two containers without direct equivalents in STL and we will discuss them in the following in a little more detail.