Does anyone know of any other good articles that I could read about containers etc?
the containers have a lot of similar interfaces, so the big thing is to learn when to use which ones.
for that, a bit of research online can help.
https://embeddedartistry.com/blog/2017/08/23/choosing-the-right-stl-container-general-rules-of-thumb/
or maybe a flow chart:
https://stackoverflow.com/questions/471432/in-which-scenario-do-i-use-a-particular-stl-container
or this cross reference:
https://www.hackerearth.com/practice/notes/c-stls-when-to-use-which-stl/
that said, I use unordered map, vector, string, and maybe set the most. But this is largely tied into what kinds of problems you solve. most of mine involve raw iteration or random access of mostly static or nearly static data.
be aware that valarray exists and excels at math work. It is unloved in most of these overviews.
if you want to get in deep as to how they work, the names need to be boiled back to common ones instead of c++ ones.
c++ / normal people
list or forward list / linked list
unordered map / hash table
vector / array
most of the rest of them like stack are named ok. C++ lacks graph and tree but some of the containers use a tree (see the links).
finally, a math nerd word of warning: set isnt exactly a math set, vector isnt a math/physics vector (its almost a column vector in linear algebra, kinda), and so on. Dont try to apply math terms to c++ names.
The limit would be a little less the the RAM available |
its probably the largest block of ram available. Strings and vectors require a solid block of ram, most of the others can be split across the whole pile, and in any case, virtual memory could mess with the numbers too. Maybe, for now, just assume you can store 10GB+ worth and if you need more than that revist the question. 10GB is a fair bit of data and today's best home computers hold 6 times that while corporate machines hold far, far more.