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; or, in the case of match(), takes a character string argument pattern and returns a Boolean result sequence.

Sequence<T> abs() const;

Return the sequence of absolute values of the object's elements

Sequence<T> -() const;

Return the sequence of the negative of the object's elements

Sequence<mco_seq_bool> match(char const* pattern) const;

Match the elements of a sequence of characters with the specified pattern and return a sequence of Boolean values

Example

Following is an example code snippet demonstrating unary operators :

     
    {
        ...
        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 = abs(diff);
            
        ...
    }