cs246-s11-001-july14

cs246-s11-001-july14 - CS 246 (Spring 2011) Section 1...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 246 (Spring 2011) – Section 1 Purrs day 14 July The STL (continued)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS 246 (Spring 2011) - Section 001 - Thursday 14 July 2 Today's Agenda Finish STL stuff With any remaining time in today's class Next week Namespace Selected topics from Chapters 3 and 4
Background image of page 2
CS 246 (Spring 2011) - Section 001 - Thursday 14 July 3 Vector (review) Checking the size of a vector cout << v .size() << endl; if ( ! v .empty() ) { . . . } Operations that change the size of a vector (see diagram on board) v .push_back (12); // add to end v .pop_back (); // remove from end v .resize (3); // set new size to 3 v .clear (); // set new size to 0
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS 246 (Spring 2011) - Section 001 - Thursday 14 July 4 Iterators (review) An iterator is used to traverse through the elements of a container Traversing left-to-right v.begin() // points to first element v.end() // points AFTER last element Traversing right-to-left v.rbegin() // points to last element v.rend() // points BEFORE first element Examples : display vector contents in both directions
Background image of page 4
CS 246 (Spring 2011) - Section 001 - Thursday 14 July 5 Iterators (review)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/08/2011 for the course CS 246 taught by Professor Wormer during the Spring '08 term at Waterloo.

Page1 / 13

cs246-s11-001-july14 - CS 246 (Spring 2011) Section 1...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online