Message-ID: <37FCEB18.CE7F0A9@arcticmail.com> From: N J Chackowsky X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: vector of vectors Content-Type: multipart/mixed; boundary="------------5C1B8690B98DF1A638DEA418" Lines: 47 Date: Thu, 07 Oct 1999 18:48:57 GMT NNTP-Posting-Host: 206.45.76.121 X-Trace: typhoon.mbnet.mb.ca 939322137 206.45.76.121 (Thu, 07 Oct 1999 13:48:57 CDT) NNTP-Posting-Date: Thu, 07 Oct 1999 13:48:57 CDT Organization: MBnet Networking Inc. To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. --------------5C1B8690B98DF1A638DEA418 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit A while back, someone asked about simulating a 2-d array using vectors, and I *thought* it was a simple problem. But then I tried it.

Original code:
    int a[3][3];

STL code:

    vector<vector<int> > a;

But how do you ensure that a has three rows and columns allocated, such that you can fearlessly execute

    a[2][2] = -1;

for example? I'm reading Stroustrup 3rd ed. and am coming up blank, but then, whole sections of this book are still a bit mysterious to me.

Nick.
  --------------5C1B8690B98DF1A638DEA418 Content-Type: text/x-vcard; charset=us-ascii; name="nick.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for N J Chackowsky Content-Disposition: attachment; filename="nick.vcf" begin:vcard n:Chackowsky;Nick tel;cell:204 729 6011 tel;fax:204 729 0365 tel;home:204 728 8184 tel;work:204 729 0363 x-mozilla-html:TRUE url:http://www.brandonsd.mb.ca/massey org:Vincent Massey High School;Business Education / Technology adr:;;715 McDiarmid Drive;Brandon;Manitoba;R7B 2H7;Canada version:2.1 email;internet:nick AT arcticmail DOT com title:Teacher fn:Nick J Chackowsky end:vcard --------------5C1B8690B98DF1A638DEA418--