So here are my 2 cents.
You should reserve the memory of your vectors beforehand. If you do not know the actual number of lines you should still be able to guess it more or less correctly from the size of the file. What you really want is to avoid constant reallocations, which are guaranteed when pushing hundreds of thouthands of elements.
Have a look here: http://stackoverflow.com/questions/11719538/how-to-use-stringstream-to-separate-comma-separated-strings https://stackoverflow.com/questions/11719538/how-to-use-stringstream-to-separate-comma-separated-strings
In short you can pass an additional separating token to the stringstream, which eliminates the need for modifying the string of the line
So here are my 2 cents.
You should reserve the memory of your vectors beforehand. If you do not know the actual number of lines you should still be able to guess it more or less correctly from the size of the file. What you really want is to avoid constant reallocations, which are guaranteed when pushing hundreds of thouthands of elements.
Have a look here: http://stackoverflow.com/questions/11719538/how-to-use-stringstream-to-separate-comma-separated-strings
In short you can pass an additional separating token to the stringstream, which eliminates the need for modifying the string of the line
So here are my 2 cents.
You should reserve the memory of your vectors beforehand. If you do not know the actual number of lines you should still be able to guess it more or less correctly from the size of the file. What you really want is to avoid constant reallocations, which are guaranteed when pushing hundreds of thouthands of elements.
Have a look here: https://stackoverflow.com/questions/11719538/how-to-use-stringstream-to-separate-comma-separated-strings
In short you can pass an additional separating token to the stringstream, which eliminates the need for modifying the string of the line
So here are my 2 cents.
You should reserve the memory of your vectors beforehand. If you do not know the actual number of lines you should still be able to guess it more or less correctly from the size of the file. What you really want is to avoid constant reallocations, which are guaranteed when pushing hundreds of thouthands of elements.
Have a look here: http://stackoverflow.com/questions/11719538/how-to-use-stringstream-to-separate-comma-separated-strings
In short you can pass an additional separating token to the stringstream, which eliminates the need for modifying the string of the line