Forward Circulator (Circulator)

Definition

A class Circulator that satisfies the requirements of a forward circulator for the value type T, supports the following operations.

Creation

Circulator c;

Circulator c ( Circulator d);

Operations

bool c = Circulator d Assignment.

bool c == NULL Test for emptiness.

bool c != NULL Test for non-emptiness. The result is the same as !(c == NULL).

bool c == Circulator d Test for equality: Two circulators are equal if they refer to the same item.

bool c != Circulator d Test for inequality. The result is the same as !(c == d).

T& * c Returns the value of the circulator. If Circulator is mutable *c = t is valid.
Precondition: c is dereferenceable.

Circulator& ++ c Prefix increment operation.
Precondition: c is dereferenceable.
Postcondition: c is dereferenceable.

Circulator c ++ Postfix increment operation. The result is the same as that of Circulator tmp = c; ++c; return tmp; .

Bidirectional Circulator (Circulator)

Definition

A class Circulator that satisfies the requirements of a bidirectional circulator for the value type T, supports the following operations in addition to the operations supported by a forward circulator.

Operations

Circulator& -- c Prefix decrement operation.
Precondition: c is dereferenceable.
Postcondition: c is dereferenceable.

Circulator c -- Postfix decrement operation. The result is the same as that of Circulator tmp = c; --c; return tmp; .

Random Access Circulator (Circulator)

Definition

A class Circulator that satisfies the requirements of a random access Circulator for the value type T, supports the following operations in addition to the operations supported by a bidirectional Circulator.

Operations

Circulator& c += int n The result is the same as if the prefix increment operation was applied n times, but it is computed in constant time.

Circulator c + int n Same as above, but returns a new circulator.

Circulator int n + c Same as above.

Circulator& c -= int n The result is the same as if the prefix decrement operation was applied n times, but it is computed in constant time.

Circulator c - int n Same as above, but returns a new circulator.

T& c [ int n ] Returns *(c + n).

int c - Circulator d returns the difference between the two circulators within the interval [ 1-s , s-1 ] for a sequence size s. The difference for a fixed circulator c (or d) with all other circulators d (or c) is a consistent ordering of the elements in the data structure. There has to be a minimal circulator dmin for which the difference c- dmin to all other circulators c is non negative.

Circulator c.min_circulator () Returns the minimal circulator cmin in constant time. If c has a singular value, a singular value is returned.

There are no comparison operators required.