I have a class that has functions which use <stdio.h> and <stdarg.h> to take in indefinite arguments, and one of the member functions taking in filenames. There's another function (call it the "do" function) where I want to read from ifstreams created from those indefinite number of filenames.
I can create a vector<string> and then create new ifstreams in the do() function each time it's called, and use seekg(). But in this case the do() function is called millions of times, the files are dozens of megabytes in size, and the file reads I want to do are sequential and this method would seek from ios::beg each time. So that would be incredibly inefficient.
I thought one solution would be to create a vector<ifstream> as a member variable and read using the seekg() ios::cur option for each of the ifstream vector elements. However I found that's not possible because you can't create a vector of ifstream elements.
Does anyone have any ideas on how I might better approach this?