I don't understand the question. Are you asking if reading from a stringstream is faster than reading from an fstream?
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
1) Is the extraction operator using the get() function in case of fstream?
Probably not. More likely is that it uses the member functions of the stream buffer directly (just like get()).2) Does moving the file pointer imply another call to seekg()?
No, the file pointer is at a much lower level than seekg().3) Would this mean stringstream's get() function would be faster?
It's fairly safe to assume that stringstream's get() function is faster, but that's because you're accessing strings in memory rather than hardware.4) Would this 'ss << std::fstream ("file.xml",std::ios::in).rdbuf();' be faster than both operations since the buffer is already filled?
Well, obviously it comes down to the quality of the implementation, but writing the stream buffer is typically the fastest way to dump the contents of a stream.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Reading from a hard drive is typically around a million times slower than reading/writing to memory. I read that somewhere, don't quote me.
pseudorandom21
Practically a Posting Shark
890 posts since Jan 2011
Reputation Points: 216
Solved Threads: 111