Translations of this page?:

Valarray operators

Syntax:

    #include <valarray>
    valarray& operator=( const valarray& v ); // copy v
    valarray& operator=( const T& val ); // assign val to every element
 
    TYPE operator[]( size_t index ) const;
    TYPE& operator[]( size_t index );
 
    valarray operator[]( slice s ) const;
    slice_array<TYPE> operator[]( slice s );
 
    valarray operator[]( const gslice& s ) const;
    gslice_array<TYPE> operator[]( const gslice& s );
 
    valarray operator[]( const valarray<bool>& mask ) const;
    mask_array<TYPE> operator[]( const valarray<bool>& mask );
 
    valarray operator[]( const valarray<size_t>& indirect ) const;
    indirect_array<TYPE> operator[]( const valarray<size_t>& indirect );
 
    valarray& operator=( const slice_array& s );
    valarray& operator=( const gslice_array& g );
    valarray& operator=( const mask_array& mask );
    valarray& operator=( const indirect_array& i );

A valarray can be assigned to another of the same size. The assignment operator will copied each element from one array to the other as expected. However, if the arrays are of different sizes, the result is undefined. It is unwise to expect any errors or exception handling to occur because of mismatched array sizes or exceeding bounds of the valarray. Valarrays are optimized for speed and their implementation is machine and compiler specific.

 
• • • IndexRecent changesRSScc