Skip to content. Skip to navigation

ICTP Portal

You are here: Home Manuals on-line PGI Compiler pgC_lib Bidirectional Iterators
Personal tools
Document Actions

Bidirectional Iterators

Click on the banner to return to the class reference home page.

Bidirectional Iterators



An iterator that can both read and write and can traverse a container in both directions.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)



For a complete discussion of iterators, see the Iterators section of this reference.

Iterators are a generalization of pointers that allow a C++ program to uniformly interact with different data structures. Bidirectional iterators can move both forwards and backwards through a container, and have the ability to both read and write data. These iterators satisfy the requirements listed below.

Key to Iterator Requirements

The following key pertains to the iterator descriptions listed below:

a and b
values of type X
value of distance type
u, Distance, tmp and m
value of type X&
value of type T

Requirements for Bidirectional Iterators

A bidirectional iterator must meet all the requirements listed below. Note that most of these requirements are also the requirements for forward iterators.

X u
u might have a singular value
X() might be singular
copy constructor, a == X(a).
X u(a)
copy constructor, u == a
X u = a
assignment, u == a
a == b, a != b
return value convertible to bool
equivalent to (*a).m
return value convertible to T&
returns X&
return value convertible to const X&
returns T&
returns X&
return value convertible to const X&
returns T&

Like forward iterators, bidirectional iterators have the condition that a == b implies *a== *b.

There are no restrictions on the number of passes an algorithm may make through the structure.

See Also

Containers, Iterators, Forward Iterators

©Copyright 1996, Rogue Wave Software, Inc.

Powered by Plone This site conforms to the following standards: