- Mastering C++ Programming
- Jeganathan Swaminathan
- 168字
- 2021-07-02 18:28:48
Iterators
An iterator is a design pattern, but interestingly, the STL work started much before
Gang of Four published their design patterns-related work to the software community. Iterators themselves are objects that allow traversing the containers to access, modify, and manipulate the data stored in the containers. Iterators do this so magically that we don't realize or need to know where and how the data is stored and retrieved.
The following image visually represents an iterator:

From the preceding image, you can understand that every iterator supports the begin() API, which returns the first element position, and the end() API returns one position past the last element in the container.
The STL broadly supports the following five types of iterators:
- Input iterators
- Output iterators
- Forward iterators
- Bidirectional iterators
- Random-access iterators
The container implements the iterator to let us easily retrieve and manipulate the data, without delving much into the technical details of a container.
The following table explains each of the five iterators:

- The Supervised Learning Workshop
- Game Programming Using Qt Beginner's Guide
- Mastering Spring MVC 4
- MySQL 8 DBA基礎教程
- Essential Angular
- 深度強化學習算法與實踐:基于PyTorch的實現
- SSM輕量級框架應用實戰
- 軟件項目管理實用教程
- 零基礎學Python網絡爬蟲案例實戰全流程詳解(高級進階篇)
- 數據結構習題解析與實驗指導
- PHP從入門到精通(第4版)(軟件開發視頻大講堂)
- Julia for Data Science
- 零代碼實戰:企業級應用搭建與案例詳解
- Building Slack Bots
- 青少年學Python(第2冊)