Sequential storage containers of QT containers (Introduction)

Source: Internet
Author: User
Tags types of functions

"""
Container containers, which is also called collection, refers to the ability to store other features in memory.
Object of a specific type, which is generally a common template class.
That is, the QT container class does not have different implementations because of different compilers. The so-called "implicit data sharing" can also be called "copy on write during write ", this technique allows passing value parameters in the container class without additional performance loss. The QT container class provides traversal syntax similar to Java, and also provides traversal syntax similar to STL,
To help you select the encoding method you are used. Finally, STL is often unavailable on some embedded platforms. In this case, you can only use the container class provided by QT unless you want to create it yourself.
"""
"""
The first sequential storage container is qvector <t>, that is, vector. Qvector <t> is an array-like container that stores data in the continuous memory area.
Qvector <t> knows its own length and can change its size. To obtain data at random locations or add data at the end,
Qvector <t> is very efficient. However, it is not very efficient to insert or delete data in the middle.
"""
"""
Qt provides ordered storage containers: qlist, Q & A list, qvector, qstack, and qqueue. For
For most applications, qlist is the best choice. Although it is an array-based list, it provides a fast
Add to and append. If you need a linked list, you can use qinilist. If you want all
The element occupies the continuous address space. You can select qvector. Qstack and qqueue are LIFO and FIFO
----
Qt also provides associated containers: qmap, qmultimap, qhash, qmultihash, and qset. With "multi"
Containers with words can be associated with multiple values on a single key. The "hash" container provides faster search based on the hash function,
The non-Hash container is an ordered set based on binary search.
Two other special cases: qcache and qcontiguouscache provide efficient hash query in a limited cache space
Find.
"""
"""
Qlist <t>: The most common window. It is stored as a list of objects of the specified type T. It is associated with an integer index and implemented using arrays internally,
Quick access to these indexes is also provided. You can use append () and prepend () to add elements at the end of the list or in the header, or use insert () to insert elements at the specified position.
Inherited from the qlist <qstring> class
"""
"""
Qinilist <t> is similar to qlist. In addition to traversing, instead of Random Access Based on Integer indexes, qinilist has a higher performance than qlist for inserting a large amount of data in the middle.
At the same time, it has better traversal semantics (as long as the data exists, its traversal will point to a valid element. when data is inserted or deleted, the qlist traversal will point to an invalid value)
"""
"""
Qvector is used to store a series of values of the given type in the continuous area of the memory. inserting data in the header or in the middle may be very slow, because it will cause a large amount of data to move in the memory.
----
Qstack <t> is a sub-class of qvector. Compared with qvector, it provides several functions: Push (), pop (), top ()
----
Queue <t> is a sub-class of qlist. It has the first-in-first-out (FIFO) semantics. Compared with qlist, it provides several functions: enqueue (), dequeue (), head ()
Qset <t> provides a set of Single-value mathematics for fast search.
"""
"""
The qmap (Key, T) Dictionary data structure (associated array) associates keys of the same type as the tvalue. Generally, each key is associated with a value. qmap stores data in key order, qhash provides better performance in case of order independence
----
Qmultimap <key, T> is a subclass of qmap. It provides multi-value ing and multiple values of one key object.
----
Qhash <key, T> is almost the same as the qmap interface, but it provides faster queries and stores data in alphabetical order.
Qmultihash <key, T> is a subclass of qhash and provides multi-value hash.
"""
"""
All containers can be nested. For example, qmap <qstring, Q List <int> is a ing, and its key is qstring.
Type. The value is of the qlist <int> type. That is to say, each value can store multiple int types.
The data that can be stored in the container must be of the data type that can be assigned a value. The data type that can be assigned a value is constructed by default.
Types of functions, copy constructors, and value assignment operators. The vast majority of data types, including basic types, such as int and
Double, pointer, and QT data types, such as qstring, qdate, and qtime, are value-able data types. However
Yes, qobject and its subclass (qwidget, qtimer, etc.) are not. That is, you cannot use
Qlist <qwidget> is a container because the copy constructor and value assignment operator of qwidget are unavailable. If you
A container of this type can only store its pointer, that is, qlist <qwidget *>
If you want to use qmap or qhash, additional auxiliary functions must be provided as the key type. Qmap key is required
Operator <() overload is required. The key of qhash must provide operator = () overload and a key named qhash ()
.
The QT container class can be accessed directly using qdatastream. In this case, the types stored in the container must also be
Use qdatastream for storage. This means that operator <() and operator> () operations need to be reloaded.
Character
"""

For more download: http://vdisk.weibo.com/s/rtCAtswlNbj

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.