I have a variable with type std::deque<float>
, I'm sriting its contents to a file like following:
std::deque<float> queue;
// ...
std::ofstream file ("out.txt");
if (file.is_open())
{
file.precision(12);
std::copy(queue.begin(), queue.end(), std::ostream_iterator<float>(file, ";"));
}
file.close();
Is there a straightforward way to read it back from file like the way I wrote it? I mean without reading file and then looping?