468,469 Members | 2,402 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,469 developers. It's quick & easy.

Most recent C++ version of similar to VB6 listbox?

SwissProgrammer
211 128KB
It has been discovered, years ago, that in Microsoft Visual Basic 6.0 (with service pack 5) a listbox can handle and also sort over 1,000,000 entries.

What is the most recent version of C++ (NOT using Visual Basic, and NOT using Visual C++, and NOT using .net) code does this? An example please.

Thank you.
3 Weeks Ago #1
3 4181
Banfa
9,052 Expert Mod 8TB
Erm, I don't quite follow, no version of C++ has a list box; you'd have to include some sort of graphical environment.

Alternatively are you talking about the capacity of the standard containers, i.e. std::list. They have a method that returns there maximum capacity std::list::max_size. This is theoretical so you normally get a value of max signed/unsigned 32/64 bit integer**. The actual capacity of of a std::list is dependent on both how much memory is available and the size of the object it is storing.


** I assume it returns this in all cases, I don't find it to be a very useful method so I rarely call it and I certainly haven't called it on a list with a data type that is very large and therefore may allow a calculation of actual max size given available memory and data type size which is possible.
3 Weeks Ago #2
SwissProgrammer
211 128KB
Banfa, thank you.

Searching for std::list which you mentioned, I found https://www.guru99.com/cpp-list.html .

Then https://en.cppreference.com/w/cpp/container/list .

Then https://en.cppreference.com/w/cpp/container/list/sort .

Then https://www.cplusplus.com/reference/list/list/sort/ .

It looks like using std::list is maybe more versatile than using vector.

And C++ seems to have packaged a lot of code into std::list that I now do not have to write.

Thank you Banfa.

Comments?

Observations that I might have missed?

Applications that I might find useful?
2 Weeks Ago #3
Banfa
9,052 Expert Mod 8TB
I used to use https://www.cplusplus.com a lot but it seems to have given up at C++11, I used to use https://en.cppreference.com a bit but have started using it more since cplusplus gave up because it adds data for each new version of the standard.

It sounds a bit like you are unfamiliar with the standard containers https://en.cppreference.com/w/cpp/container. It is worth familiarising yourself with them and particularly their differences so you can choose the right one.

The rule of thumb that I (and others) use is your default choice should be the vector; only use a different container if you have a valid conveyable reason why you need to that type rather than the vector (needing to sort would a good reason to use std::list over std::vector, sorting a vector is slow)

Early on std::set tripped me up a couple of times because I put data in one and then wanted to change it but couldn't. That is correct behaviour for a set because a set is an ordered collection of keys, they have to be immutable because changing the value of a key would necessitate re-ordering the set.

I would say over 15-20 years the containers I use most are std::vector, std::list and std::map. I have use std::deque occasionally but in truth I am hard pressed to give you a good reason to use that instead of std::list. I've also used the std::queue container adaptor.
2 Weeks Ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Nova's Taylor | last post: by
3 posts views Thread by Suresh Kumaran | last post: by
1 post views Thread by getyourbiglobster | last post: by
1 post views Thread by Eric Del Sesto | last post: by
4 posts views Thread by Lee | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.