Skip to content

A customer iterator for vector. It illustrates how to write a customer iterator for your container.

License

Notifications You must be signed in to change notification settings

sonugiri1043/Designing_CPP_Iterators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Iterators

Iterators are a generalisation of pointers: they are objects that point to other objects. As the name suggests, iterators are often used to iterate over a range of objects: if an iterator points to one element in a range, then it is possible to increment it so that it points to the next element.

We implemented an Iterator for vector class. To accomplish that we need to do the following:

  • Write begin and end functions which returns an iterators pointing at begining and end of vector resp.

  • Similarly we implemented rbegin and rend which returns an iterators pointing at end and beginning of vector resp.

  • We defined a iterator class inside vector class.

  • We overloaded '!=', '++', * operator which is used on iterator.

This much is sufficient to write a simple iterator.

About

A customer iterator for vector. It illustrates how to write a customer iterator for your container.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages