operator- (<valarray>)
Element-wise 해당 요소 또는 크기가 동일한 두 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
값 또는 역할에서 다른 값 또는 valarrays 차이 형성에서 뺄 수 있는 minuend valarray._Right
값 또는 다른 값 또는 valarrays 형성 차이에서 뺄 수 있는 subtrahend 역할을 valarray.
반환 값
요소가 element-wise 차이 valarray의 _Left 및_Right.
설명
산술 빼기 설명에 사용 되는 용어:
차이 = minuend-subtrahend
예제
// valarray_op_ediff.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 ] = 10;
for ( i = 1 ; i < 8 ; i += 2 )
vaL [ i ] = 0;
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 difference is the\n valarray: ( ";
for (i = 0 ; i < 8 ; i++ )
cout << vaNE [ i ] << " ";
cout << ")." << endl;
}
요구 사항
헤더: <valarray>
네임 스페이스: std