data type to use for dynamically changing number of items

I will be parsing out lists of words from string, and placing those words into a data structure that is yet to be determined, but can be resized with each new parsing. I will not know the number of words ahead of time in order to allocate the data type/structure memory. The results will not need to have their order changed. I will need to refer to them in initial order though.

I'm aware of arrays, just read a little about vectors, and am now looking at heaps. is there some other data structure I should use. If not, which of these might I use.

The contents will be refilled from another string read in in each loop, and previous contents will not be saved, except as they are stored into a non-dynamic struct after my code reviews the contents.

So, what data type or structure should I be looking at to do this? Thank you for your time.
Last edited on
sounds perfect for a vector.
Just found another one called deque. What about that one?
See 'Prefer using STL vector by default unless you have a reason to use a different container'
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rsl-vector
excellent, thanks.
Topic archived. No new replies allowed.