Get an introduction to lists and see how they are contrasted with other containers.
- [Instructor] Now I'd like to show you how easy it is…to modify your code from working with a vector…to working with a link list.…That's why we'll start with the source code file…for the vector demo just as we left it.…From that point, I'll show you what needs to be adapted.…So I'll start by changing this comment in line one first.…Now we'll see std, double colon, list.…Next, in line five, we'll change the library we use…from vector to list.…
Now, for the print function in line nine,…we have a vector defined here.…We will change it to a list.…Line 10 requires the message to change…from vector to list just to be consistent.…And, although this is not critical,…I will rename the parameter in line nine…that's called my_vector, I'll rename it to my_list.…
It also appears in line 11.…Now, inside the main function,…all I need to do is change line 17…from a vector definition to a list definition.…All of these changes are possible…because of the way vectors and lists are defined…in the C++ STL.…If we take a look at the rest of the code,…
- Why the STL is important
- Containers and iterators
- Vectors and lists
- Stacks and dequeues
- Associative containers
Skill Level Advanced
1. The Standard Template Library
2. Vectors and Lists
3. Stacks, Queues, and Deques
4. Associative Containers
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.