CS 240 Lecture Notes - Lecture 12: Standard Template Library, Bounds Checking, Linked List

56 views6 pages

Document Summary

Now that we have templates why are rewriting a linked list class if we can write it once and use it for any type. C++ has what is called the stl (standard template library). Applies this to our adts (abstract data types). The library has : vectors, stacks/queues, list (doubly) If you want to use vectors in your code. They always adapt to an existing data structure: examples, stack, queue, iterators: Let"s talk a(cid:271)out methods for ve(cid:272)tors: push_back()://equivalent of insert or create. We have two ways to read a vector: V[0] = 10;// same as the array syntax notation. pop_back(); //deletes the last element on the end. //means we do not need to know the size of the array. //if we are using these pointers. for(; startptr < endptr; startptr++){ Inside the vector class we have a nested class called. Any time we want to loop through our vector we create an iterator object.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents