vector<bool>::reference::operator bool
Rzuca zmiennej vector <bool>:: odniesienia.
operator bool( ) const;
Wartość zwracana
Wartość logiczna element wektora.
Uwagi
Nie można modyfikować obiektów wektorowych przez ten podmiot.
Przykład
// vector_bool_ref_opbool.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
int main( )
{
using namespace std;
typedef vector<bool> boolvector;
boolvector v;
v.push_back( false );
boolvector::reference ref1 = v.at( 0 );
cout << ref1 << endl; // ref1 implicitly cast to bool
bool b1;
// One form of an explicit cast
b1 = ref1.operator bool( );
cout << b1 << endl;
// Another form of an explicit cast
b1 = bool( ref1 );
cout << b1 << endl;
}
Wymagania
Nagłówek: <vector>
Obszar nazw: std