more ifstream questions, vector allocation & getline()

I have a text file that reads:

vector<Event_Information_Structure> Event_Data {["struct", "information", "here"]["and", "some", "more"]["and a lot", "more about", "other things"]["a big", "long list", "of them"]}

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?
You don't need to know the size in advance, you can just keep adding elements to an initially empty vector.
Is this vector going to be used as an event queue? If so, you should use a list, a queue, or a deque, not a vector.
Topic archived. No new replies allowed.