QtCore vs C++ STL & boost lib (2) Container

copyright (C) qingfeng Xia 2011-2020 CC-BY-NC 4.0

 

just read the article: < Understand the Qt containers >

http://marcmutz.wordpress.com/effective-qt/containers/

key points

(1) difference:

a)Qt Containers:  implicitly shared (Copy-On-Write) !

b) size type: QT return signed int, while STL return size_t (unsigned int)

c) Iterator

(2)Qt has C++ STL style API, stick to these API style(3) Usage QVector  instead of QList as much as possible

 

Qt containers and their STL counterparts

The following table summarises the main sequential and associative Qt containers and their STL counterparts. For the most part, we will ignore the string classes, even though technically, they are also containers.

Qt STL
Sequential Containers
QVector std::vector
std::deque
QList
QLinkedList std::list
std::forward_list
Associative Containers
QMap std::map
QMultiMap std::multimap
std::set
std::multiset
QHash std::unordered_map
QMultiHash std::unordered_multimap
QSet std::unordered_set
std::unordered_multiset


CC-BY-NC 4.0 licensed free for non-commercial usage
Author: Qingfeng XIA
copyright (C) 2011-2020
http://www.iesensor.com
please keep the original link in your reference.
https://www.iesensor.com/blog/2013/03/06/qtcore-vs-c-stl-boost-lib-2-container/
This entry was posted in Programming. Bookmark the permalink.