So, I would like to parse a file through some kind of stream and I could indeed just simply use the ifstream class, but the problem is that I'm aiming for performance and all those >> operators for the ifstream class could really slow down my program. So I came up with the idea to somehow read the entire file into a std::stringstream, and then parse the file with the stringstream. I would like to do something like this, but I could not get it to work:
std::ifstream fin( p_Filename.c_str( ) );
fin.seekg( 0, std::ifstream::end );
int fileSize = static_cast<int>( fin.tellg( ) );
fin.seekg( 0, std::ifstream::beg );
std::stringstream ss;
ss.str( ).resize( fileSize );
fin.read( const_cast<char*>( ss.str( ).c_str( ) ), fileSize );
ss << fin.rdbuf();.but the problem is that I'm aiming for performance and all those >> operators for the ifstream class could really slow down my programAnd you know this because you've written your app and profiled accordingly, right?