<<< Iterators revisited     Index     std::sort >>>

21. Iterator types and functionality


Access Type Iterator Type
Output Input Forward Bidirectional Random
Write *p=x   *p=x *p=x *p=x
Read   x=*p x=*p x=*p x=*p
Pointer   p->f p->f p->f p->f
Iteration ++p ++p ++p ++p
--p
++p p+n p-n p+=n p-=n
--p
Comparison   p==q
p!=q
p==q
p!=q
p==q
p!=q
p==q p>q p<q p>=q p<=q
p!=q
  • where

    • x is an item pointed by the iterator,

    • q is another iterator,

    • f is a data field in a struct,

    • n is an integer number.


<<< Iterators revisited     Index     std::sort >>>