I started out with good intentions for this post, but...
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <iterator>
using namespace std;
int main()
{
vector<vector<int> > my2Dvector;
ifstream file("file.txt");
string line;
while ( getline(file, line) )
{
istringstream iss(line);
int value;
vector<int> my1Dvector;
while ( iss >> value )
{
my1Dvector.push_back(value);
}
my2Dvector.push_back(my1Dvector);
}
// (horrible, but an example)
for ( vector<vector<int> >::size_type i = 0; i < my2Dvector.size(); ++i )
{
for ( vector<int>::size_type j = 0; j < my2Dvector[i].size(); ++j )
{
cout << my2Dvector[i][j] << ' ';
}
cout << '\n';
}
}
/* file.txt
1 2 3
4 5 6 7
8 9
*/
/* my output
1 2 3
4 5 6 7
8 9
*/
...it ended up like this.