Unary C++ Sequence Methods

The following unary C++ methods and operator take no arguments, perform the indicated operation on the object's sequence, and return a result sequence of the same type. The exception is match(), which takes a character string argument pattern and returns a Boolean result sequence.

Sequence<T> abs() const;
Returns the sequence of absolute values of the object's elements.
Sequence<T> operator-() const;
Returns the sequence of the negatives of the object's elements.
Sequence<mco_seq_bool> match(char const* pattern) const;
Matches the elements of a sequence of characters with the specified pattern and returns a sequence of Boolean values.

Example

The following code snippet demonstrates unary operations:

    {
        ...
        Sequence<float> high = quote.high_iterator();
        Sequence<float> low = quote.low_iterator();
        Sequence<float> diff;
        Sequence<float> neg;
        Sequence<float> abs;
        ...
        diff = high - low;

        neg = -diff;

        abs = diff.abs();

        ...
    }