I also have a function that can read other types of data (such as integers and vectors of integers) from other sections of the above text file. Anyways what I want to do with that line above is count how many events there are (each one is enclosed in [] square brackets), then initialize a structure vector (basically just like the from the file above) containing an element for each event, and go through the events one by one and input the data to the vector.
My question is, do I actually need to know the number of events/elements to initialize the vector, or can I initialize it without a specific size and just keep adding on elements?
If I do need to know the number, how can I do this? Right now I'm thinking copy all the data to a string using getline(), then run through the elements and count the number of [ open brackets. However if I use getline(), won't I need to know roughly how many characters there will be? Could I just put in a really high number and let the delimiter figure it out? How effective/harmful could that get?