Learn how the list is optimized for rapid insert and delete operations and is not random access. Discover elements are accessed by iterator.
- [Instructor] The List is a sequence container like a…vector but optimized for rapid insert and delete operations.…Lists do not support random access.…Here I have a working copy of list.cpp from chapter two…of the exercise files, and you'll notice we have the…template function for printing a list…and our message functions.…Again, these are just for convenience and to keep the…code, in main, free of the clutter…of these repeating patterns.…
Here, we initialize the list using the template syntax, so…this is a list of integers, and it's initialized with the…Initializer List, which is available beginning in C++ 11,…and it's a very convenient way…to initialize these containers.…We print the value of it and then we print messages…for size, front, and back.…When I build and run, you'll see these here.…There we print the list and size: 10, front: 1, back: 10.…
This should all be familiar from the vector.…We can use push back to put an element on the back,…and here we have the 47 on the back of the list.…And, in order to insert and erase elements,…
- Template fundamentals
- STL containers
- Accessing iterators
- Output, forward, and bidirectional iterators
- The transform function
- Transforming strings and types
- Arithmetic, relational, and logical functions
- STL algorithms
Skill Level Intermediate
2. STL Containers
3. STL Iterators
5. STL Functions
6. STL Algorithm
- 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.