# The C++ Sequence Class

> > The Sequence class is used for managing database fields of type sequence.

> > ### For an overview see page C++ Classes

> > As explained in page Using Sequences in C++, a C++ Sequence instance is essentially an iterator over the vector of sequence values. When using a Sequence instance it is important to bear in mind that the iterator, once used, in order to be used again needs to be "rewound" by calling method `reset()` to position to the first element in the sequence. This can be an issue when constructing a "pipeline" of operators. For example, in the following code snippet, the Sequences `open` and `close` are used (iterated) in the expression (which uses the comparison operator ">") to produce the Boolean result `daysUp`. Then both `open` and `close` are reset before using them again to produce the Sequence `equal`:

> > ##

> >         Sequence<float> open = quote.open_project(days);
> >         Sequence<float> close = quote.close_project(days);
> >         Sequence<mco_seq_bool> daysUp = close > open;
> >         open.reset();

> >         close.reset();

> >         Sequence<mco_seq_bool> equal = close == open;

> > As shown above, Sequence objects are typically initialized from the `mcocomp` generated `classname_fieldname_iterator()` functions for sequence fields. Then the Sequence methods and operators offer a convenient interface for performing operations on the underlying database fields.

> > Please see page Sequence Analytics Methods by Category for detailed explanations and examples.