operator* (<valarray>)
Получает — мудрый продукт между соответствующими элементами 2 также изменить valarrays или valarray указанное значение.
template<class Type>
valarray<Type> operator*(
const valarray<Type>& _Left,
const valarray<Type>& _Right
);
template<class Type>
valarray<Type> operator*(
const valarray<Type>& _Left,
const Type& _Right
);
template<class Type>
valarray<Type> operator*(
const Type& _Left,
const valarray<Type>& _Right
);
Параметры
_Left
Первый из 2 valarrays элементы которых быть умноженным или указанного значения, которые нужно умножить с каждым элементом valarray._Right
Второй из 2 valarrays элементы которых быть умноженным или указанного значения, которые нужно умножить с каждым элементом valarray.
Возвращаемое значение
Valarray, элементы которого — мудрый продукт _Left и _Right.
Пример
// valarray_op_eprod.cpp
// compile with: /EHsc
#include <valarray>
#include <iostream>
int main( )
{
using namespace std;
int i;
valarray<int> vaL ( 8 ), vaR ( 8 );
valarray<int> vaNE ( 8 );
for ( i = 0 ; i < 8 ; i += 2 )
vaL [ i ] = 2;
for ( i = 1 ; i < 8 ; i += 2 )
vaL [ i ] = -1;
for ( i = 0 ; i < 8 ; i++ )
vaR [ i ] = i;
cout << "The initial Left valarray is: ( ";
for (i = 0 ; i < 8 ; i++ )
cout << vaL [ i ] << " ";
cout << ")." << endl;
cout << "The initial Right valarray is: ( ";
for (i = 0 ; i < 8 ; i++ )
cout << vaR [ i ] << " ";
cout << ")." << endl;
vaNE = ( vaL * vaR );
cout << "The element-by-element result of "
<< "the multiplication is the\n valarray: ( ";
for (i = 0 ; i < 8 ; i++ )
cout << vaNE [ i ] << " ";
cout << ")." << endl;
}
Требования
Заголовок:<valarray>
Пространство имен: std