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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SwissProgrammer
    New Member
    • Jun 2020
    • 220

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

    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.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    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.

    Comment

    • SwissProgrammer
      New Member
      • Jun 2020
      • 220

      #3
      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?

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        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.

        Comment

        Working...