Multi dimensional arrays in STL?

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
New poster
Posts: 10
Joined: Tue Jul 05, 2005 5:22 pm

Multi dimensional arrays in STL?

Post by someone2 » Wed Jul 20, 2005 9:01 am

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 :)

User avatar
Krzysztof Duleba
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland

Post by Krzysztof Duleba » Wed Jul 20, 2005 9:30 am

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?

Post Reply

Return to “C++”