1 / 4

Iterator

vector<int> ivec. Iterator. *myiter. vector<int>::iterator myiter. vector<int>::iterator b = ivec.begin(). vector<int>::iterator e = ivec.end(). ++ myiter. Iteratoranvändning. for (vector<string>::iterator myiterator = mycontainer.begin(); myiterator!= mycontainer.end();

akio
Download Presentation

Iterator

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. vector<int> ivec Iterator *myiter vector<int>::iterator myiter vector<int>::iterator b = ivec.begin() vector<int>::iterator e = ivec.end() ++myiter CD5250 OOP med C++ Mats Medin MDH/IDT

  2. Iteratoranvändning for (vector<string>::iterator myiterator = mycontainer.begin(); myiterator!= mycontainer.end(); ++ myiterator) cout << * myiterator << endl; CD5250 OOP med C++ Mats Medin MDH/IDT

  3. Iteratorklass container<T>::iterator ++ * == != (ev. fler) CD5250 OOP med C++ Mats Medin MDH/IDT

  4. Alla abstrakta containertyper definierar • iterator-typ • const_iterator-typ • för traversering av const container Varje abstrakt containertyp har members • begin() • end() CD5250 OOP med C++ Mats Medin MDH/IDT

More Related