Choosing of STL container
-
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
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 [^].
Величие не Бога может быть недооценена.
-
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
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?
-
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
It really depends on how you want to access table items. Yuo may, for instance use a
vector
ofstruct
, where eachstruct
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] -
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 [^].
Величие не Бога может быть недооценена.
-
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?
-
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
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;