delorie.com/archives/browse.cgi | search |
From: | "Jesper Lund" <jl1204 AT worldonline DOT dk> |
Newsgroups: | comp.os.msdos.djgpp |
References: | <9lor3c$37cki$1 AT reader02 DOT wxs DOT nl> <837kvzg30b DOT fsf AT mercury DOT bitbucket> <9lrk0v$3680a$1 AT reader01 DOT wxs DOT nl> |
Subject: | Re: Q: 2 dimensional array with STL is possible? |
Lines: | 40 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2615.200 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2615.200 |
Message-ID: | <9jgg7.20089$Ay1.277911@news000.worldonline.dk> |
Date: | Tue, 21 Aug 2001 00:36:50 +0200 |
NNTP-Posting-Host: | 212.54.76.170 |
X-Complaints-To: | news-abuse AT wol DOT dk |
X-Trace: | news000.worldonline.dk 998347077 212.54.76.170 (Tue, 21 Aug 2001 00:37:57 MET DST) |
NNTP-Posting-Date: | Tue, 21 Aug 2001 00:37:57 MET DST |
Organization: | Customer of Tiscali A/S (World Online) |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
I can compile _both_ of your examples with my DJGPP 2.95.3 without any errors. Did you remember to include the C++ vector header file with #include <vector> If you still have compilation problems, please post the error messages that you get. jansb000 <jansb000 AT wxs DOT nl> wrote in message news:9lrk0v$3680a$1 AT reader01 DOT wxs DOT nl... > "Nate Eldredge" <neldredge AT hmc DOT edu> wrote > > > That seems like it would work, although I don't know for sure. Why > > not try it? > > I did, the compiler seems to accept it, but I got stuck in really using the > 2D array. > > For example (1): > > vector< vector<int> > arint; > arint.resize(20); // gives a list of 20 times vector<int>. > for (int i = 0; i < arint.size(); i++) arint[i].resize(20); // Compiler > complains... > > For example (2): > > vector<int> row; > row.resize(20); > vector< vector<int> > arint; > for (int i = 0; i < 20; i++) arint.push_back(row); // Compiler accepts... > arint[5][4] = 12; // Compiler complains... > > I forgot the exact messages from the compiler. At this point I decided to > first consult the newsgroup before going any further. >
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |