valarray<bool> Class
템플릿 클래스의 특수화 된 버전 valarray <Type> 형식의 요소 bool.
class valarray<bool>
예제
// valarray_bool.cpp
// compile with: /EHsc
#include <valarray>
#include <iostream>
int main( )
{
using namespace std;
int i;
valarray<int> vaL ( 10 ), vaR ( 10 );
valarray<bool> vaBool ( 10 );
for ( i = 0 ; i < 10 ; i += 2 )
vaL [ i ] = -i;
for ( i = 1 ; i < 10 ; i += 2 )
vaL [ i ] = i;
for ( i = 0 ; i < 10 ; i++ )
vaR [ i ] = i;
cout << "The initial Left valarray is: ( ";
for ( i = 0 ; i < 10 ; i++ )
cout << vaL [ i ] << " ";
cout << ")." << endl;
cout << "The initial Right valarray is: ( ";
for ( i = 0 ; i < 10 ; i++ )
cout << vaR [ i ] << " ";
cout << ")." << endl;
vaBool = ( vaL < vaR );
cout << "The result of the less-than comparison "
<< "test is the\n valarray<bool>: ( ";
for ( i = 0 ; i < 10 ; i++ )
cout << vaBool [ i ] << " ";
cout << ")." << endl;
}
요구 사항
헤더: <valarray>
네임 스페이스: std