STL C++ Iterators - Writing an iterator from scratch | Modern Cpp Series Ep. 138

Описание к видео STL C++ Iterators - Writing an iterator from scratch | Modern Cpp Series Ep. 138

►Full C++ Series Playlist:    • The C++ Programming Language  
►Find full courses on: https://courses.mshah.io/
►Join as Member to Support the channel:    / @mikeshah  

►Lesson Description: In this lesson I show you how to write an iterator from scratch that is compatible with range-based for-loops. We'll set the stage for how to also make this iterator compatible with several std::algorithm STL algorithms as well!

00:00 Introduction
00:58 Iterators review and use
03:50 Example of STL vector and usage with iterators
05:40 Cpp insights view of ranged-based for loops and iterators
08:00 Swapping STL data structures
08:45 Figuring out which member functions we need for iterators
09:41 Example data structure explanation
11:40 Adding 'begin' and 'end' stubs and 'iterator' struct
14:00 Adding 'struct iterator'
14:40 Design Decision on our iterators bookkeeping strategy
15:25 iterator Constructor
16:12 Idea that we can have multiple iterators to same container
17:20 Cleaning up our iterator, inspired by STL design
18:30 Placeholders for distance (ptrdiff_t)
19:40 Placeholder for iterator category
21:40 Filling out 'begin' and 'end'
23:28 'end' is beyond the data structure
24:58 Implementing pre increment and post increment
29:07 Dereference operator
31:00 Adding arrow operator
32:53 Implementing "operator==" and "operator!="
35:20 Fixing bug with pre increment
36:00 WORKING iterator -- very cool!
37:40 Review of our implementation
40:30 Wrap up and thank you to our members and subscribers

►YouTube Channel:    / mikeshah  
►Please like and subscribe to help the channel!
►Join our free community: https://courses.mshah.io/communities/...

Комментарии

Информация по комментариям в разработке