[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Max size of data in C++ prog?



On Sun, 19 Dec 2004 11:31:13 -0500, Marc Shapiro <mshapiro_42@yahoo.com> wrote:
> Vectors are single dimensional, I believe, so they wont work in this
> case, but I will remember them for the future

All arrays are technically single dimensional.  You can do a 2D array
with vectors as

vector< vector< int > > a;

or with maps

map< unsigned  int , map< unsigned int , int > > b;

or a combination of the two.  Keeping the indices straight is,
perhaps, a bit more difficult though, especially if you want to use
push_back().  If you always use operator[], though, you can pretty
much just use indexing in whatever order you'd like, as long as you're
consistent.

-- 
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh



Reply to: