I have a c++ code written in visual studio 2010, which reads a text file ( which contains tens of thousands of floating point numbers separated by space).Code reads the text file contents and store it to a vector of floating points.My problem is , code is taking alot of time to read and copy to the vector.Is there a faster way to do this.Some thing that can be done in visual studio c++ ( using boost libraries or mmap )
vector<float> ReplayBuffer;
ifstream in;
in.open("fileName.txt");
if(in.is_open())
{
in.setf(ios::fixed);
in.precision(3);
in.seekg(0,ios::end);
fileSizes = in.tellg();
in.seekg(0,ios::beg);
while(!in.eof())
{
for(float f;in>>f;)
ReplayBuffer.push_back(f);
}
in.close();
}