Page 1 of 1

Multi dimensional arrays in STL?

Posted: Wed Jul 20, 2005 9:01 am
by someone2
Hello,
This probably has been asked many times before, but, I am pretty new to STL. I was wondering about the tricks you guys use to make safe multi dimensional arrays in your C++ code.

I have seen a nice class that encapsulates a vector of vectors. However, in a real contest, there is no time for this. Any other tricks that are easy to implement in a 5 hour contest? 2 hour contest?

Thanks :)

Posted: Wed Jul 20, 2005 9:30 am
by Krzysztof Duleba
Why should you encapsulate a vector of vectors?

Code: Select all

vector<vector<int> > vvi(200, vector<int>(100, 0));
Now vvi is a two-dimensional 200x100 array filled with zeros. What's to encapsulate?