Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. container to store unique strings
Qt 6.11 is out! See what's new in the release blog

container to store unique strings

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 1.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by
    #1

    i need to store unique strings in a container. i know i can use qset. however, inserts and finds will be frequent. so i'd like to store them in something like a hash. but i only have strings (i.e. keys) and not values. what should i use?

    Joel BodenmannJ 1 Reply Last reply
    0
    • U user4592357

      i need to store unique strings in a container. i know i can use qset. however, inserts and finds will be frequent. so i'd like to store them in something like a hash. but i only have strings (i.e. keys) and not values. what should i use?

      Joel BodenmannJ Offline
      Joel BodenmannJ Offline
      Joel Bodenmann
      wrote on last edited by Joel Bodenmann
      #2

      How about QStringList? It's a type declaration to QList<QString>.
      Depending on your actual needs you can also use QVector<QString>. Either documentation lists advantages/disadvantages over the other one.

      Industrial process automation software: https://simulton.com
      Embedded Graphics & GUI library: https://ugfx.io

      1 Reply Last reply
      0
      • aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @user4592357 said in container to store unique strings:

        i need to store unique strings in a container. i know i can use qset. however, inserts and finds will be frequent. so i'd like to store them in something like a hash. but i only have strings (i.e. keys) and not values. what should i use?

        Quoting http://doc.qt.io/qt-5/qset.html :

        QSet<T> is one of Qt's generic container classes. It stores values in an unspecified order and provides very fast lookup of the values. Internally, QSet<T> is implemented as a QHash.

        Qt has to stay free or it will die.

        1 Reply Last reply
        5

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved