Kontenery STL/Qt - różnice

0

Jakie są największe różnice? Wiem, że np. iterator Qt wskazuje między elementy, a STL poza element. Ale co więcej? Wydajność, itp? Jest gdzieś jakieś porównanie tego?

1
hmm napisał(a):

Jakie są największe różnice? Wiem, że np. iterator Qt wskazuje między elementy, a STL poza element. Ale co więcej? Wydajność, itp? Jest gdzieś jakieś porównanie tego?

iteratory w Qt są kompatybilne z STL, dodatkowo jest dostępna odmiana w stylu Java.
http://qt-project.org/doc/qt-4.8/containers.html

Moja rada pisz w czystym Qt jeśli to możliwe, a STL i Qt mieszaj tylko, gdy korzystasz z zewnętrznych bibliotek, które stosują STL-a.

0

iterator Qt wskazuje między elementy, a STL poza element
co!?

0

The Qt library provides a set of general purpose template-based container classes. These classes can be used to store items of a specified type. For example, if you need a resizable array of QStrings, use QVector<QString>.

These container classes are designed to be lighter, safer, and easier to use than the STL containers. If you are unfamiliar with the STL, or prefer to do things the "Qt way", you can use these classes instead of the STL classes.

The container classes are implicitly shared, they are reentrant, and they are optimized for speed, low memory consumption, and minimal inline code expansion, resulting in smaller executables. In addition, they are thread-safe in situations where they are used as read-only containers by all threads used to access them.

For traversing the items stored in a container, you can use one of two types of iterators: Java-style iterators and STL-style iterators. The Java-style iterators are easier to use and provide high-level functionality, whereas the STL-style iterators are slightly more efficient and can be used together with Qt's and STL's generic algorithms.

Qt also offers a foreach keyword that make it very easy to iterate over all the items stored in a container.

Link: http://harmattan-dev.nokia.com/docs/library/html/qt4/containers.html

1 użytkowników online, w tym zalogowanych: 0, gości: 1