// create an empty container
deque<deque<int> > container;
// ^ this space will keep the compiler from interpreting >> as a single token
// use a temporary to create a row
deque<int> temp;
temp.push_back( 1 );
temp.push_back( 2 );
temp.push_back( 3 );
// store the row
container.push_back( temp );
Note that a vector will resize (since its reserve size cannot be specified ahead of time) resulting in a number of costly resizes (depending on the number of elements). A deque is probably more suitable.
I don't necessarily agree that a deque is better without knowing more of the requirements. You can resize the vector's after reading the info from the file if there is some kind of parameter at the start of the file that tells you how many elements are needed or if there is another way of setting the vector size prior to the point which you begin filling it.
The real question is how will you be filling the container? Do you need the data to be contiguous within each vector? How will you use the container once it is filled? A deque could definitely be a better choice but it depends on a number of factors.
Agreed, container choice should be based on the requirements. I suppose it should be said that if neither contiguous storage nor random access is a requirement then a list might be even better.
Thats the beauty of a vector over an array.....you don`t need to predefine the vector size before you load or initialize it. You could envisage a 'line' vector in which each vector element held a string terminated by '\n'.