From: "Niklas Pettersson" Newsgroups: comp.os.msdos.djgpp Subject: How should I use the Iterator with a map??? Date: Wed, 26 Jan 2000 10:33:13 +0100 Organization: Lund Institute of Technology, Sweden Lines: 41 Message-ID: <86mf46$4ua$1@news.lth.se> NNTP-Posting-Host: npedt97.univ.vxu.se X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello! I have been programming C++ for quite some time but I havn't used the standard containers very much.. Right now I'm building a compiler and I have a problem with using iterators on a map... This code shows my point (and generates an error with DJGPP)... What is wrong with this code? Shouldn't I be able to use the * operator to get the contents of the iterator? Thanks in advance / Niklas Pettersson #include #include struct SymbolTableEntry // Dummy.. Just to illustrate.. { }; map symboltable_rep; void print() { map::iterator i( symboltable_rep.begin() ); SymbolTableEntry *current = 0; while ( i != symboltable_rep.end() ) // end is one past last element { // // ERROR HERE!!! // current = *i; // Get contents of iterator... // Do stuff here with current i++; } }