Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Qt Learning Summary (C Fish) QList and QMap container classes

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

QList

The QList container is an array list with the following characteristics:

1. You can use QList in most cases. For operations like prepend (), append (), and insert (), QList is usually much faster than QVector. This is because QList stores its element items in memory based on the index tag (although memory is not contiguous, which is the same as STL's list), it is faster than container classes that rely on iterator iterations, and you have less code.

two。 When an iterator points to an item in QList, if the QList inserts or deletes, the iterator is invalid.

The 3.QStringList class inherits from the QList container class (note that QList is actually a class template with QString types in it, and then a QStringList class inherits from it).

Simple use of the QList container (since QStringList inherits from QList, all of the following uses apply equally to the QStringList container):

# include#include # includeint main (int argc, char * argv []) {QCoreApplication a (argc, argv); QList list;// creates a QList container that stores data of type QString inside the container and returns a list object that has many methods to manipulate the container. List

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report