Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Choosing of STL container

Choosing of STL container

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasedockerhelplearning
7 Posts 5 Posters 0 Views 1 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.
  • H Offline
    H Offline
    hrishiS
    wrote on last edited by
    #1

    Hi to All, Could anyone please help me choosing the best STL container to Hold a table (DB table)... Thanks in advance,

    ----------------------------- I am a beginner

    A J CPalliniC K 4 Replies Last reply
    0
    • H hrishiS

      Hi to All, Could anyone please help me choosing the best STL container to Hold a table (DB table)... Thanks in advance,

      ----------------------------- I am a beginner

      A Offline
      A Offline
      Adam Roderick J
      wrote on last edited by
      #2

      That depends on your need well my suggestions are:- I think stl map [^] will be very well suited, if you have a lot searching operations. Since it is DB table, i think it may be need to have a lot of searching. But if you have add a lot element and no need for searching then list will be better [^].

      Величие не Бога может быть недооценена.

      H 1 Reply Last reply
      0
      • H hrishiS

        Hi to All, Could anyone please help me choosing the best STL container to Hold a table (DB table)... Thanks in advance,

        ----------------------------- I am a beginner

        J Offline
        J Offline
        Jonathan Davies
        wrote on last edited by
        #3

        I'm sure it's not the answer you wanted, but It depends upon your data. It also depends upon how you want to use that data. Start by having a look at something that describes the STL Container types and see if it gives any clues. Is there a reason why you want to put the data in a container?

        H 1 Reply Last reply
        0
        • H hrishiS

          Hi to All, Could anyone please help me choosing the best STL container to Hold a table (DB table)... Thanks in advance,

          ----------------------------- I am a beginner

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          It really depends on how you want to access table items. Yuo may, for instance use a vector of struct, where each struct contains one row. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          • A Adam Roderick J

            That depends on your need well my suggestions are:- I think stl map [^] will be very well suited, if you have a lot searching operations. Since it is DB table, i think it may be need to have a lot of searching. But if you have add a lot element and no need for searching then list will be better [^].

            Величие не Бога может быть недооценена.

            H Offline
            H Offline
            hrishiS
            wrote on last edited by
            #5

            thanks,          Now, after reading from database I need to put the data of a small table in a file system...please provide some hints to do that...

            ----------------------------- I am a beginner

            1 Reply Last reply
            0
            • J Jonathan Davies

              I'm sure it's not the answer you wanted, but It depends upon your data. It also depends upon how you want to use that data. Start by having a look at something that describes the STL Container types and see if it gives any clues. Is there a reason why you want to put the data in a container?

              H Offline
              H Offline
              hrishiS
              wrote on last edited by
              #6

              I got my answer, depending on the need i guess i will go for map thanks,          Now, after reading from database I need to put the data of a small table in a file system...please provide some hints to do that...

              ----------------------------- I am a beginner

              1 Reply Last reply
              0
              • H hrishiS

                Hi to All, Could anyone please help me choosing the best STL container to Hold a table (DB table)... Thanks in advance,

                ----------------------------- I am a beginner

                K Offline
                K Offline
                KingsGambit
                wrote on last edited by
                #7

                Often you will have to combine multiple containers as per your requirements. For example to create a 2D array you can use a vector or vectors

                vector< vector > a;

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups