From: "Chia" Newsgroups: comp.os.msdos.djgpp Subject: STL Iterators Date: Sat, 19 Sep 1998 18:15:45 -0500 Organization: 404 Software Lines: 28 Message-ID: <6u1dp7$lu6@nnrp1.farm.idt.net> NNTP-Posting-Host: flex-2.top.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I'm just starting to work with the STL and I've been working with the list class. I've had some problems with the iterators, though. I'm trying to select, say, the tenth element in a list. list *foo; for(int i = 0;i < 100;i++) foo.push_back(i); list::iterator p = foo.begin() + 10; // error This won't compile, giving for a reason that there's no match for: operator +(class list::iterator, int) I have had success with incrementing p ten times: for(int i = 0;i < 10;i++) p++; Is there a way to do this more easily or something that I'm doing wrong here? Thanks! // chia AT top DOT net -- http://www.top.net/chia/