Uwaga
Dostęp do tej strony wymaga autoryzacji. Może spróbować zalogować się lub zmienić katalogi.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Przypisuje wartość logiczną lub wartość posiadanych przez odwołanie elementu, a bit.
reference& operator=(
const reference& _Right
);
reference& operator=(
bool _Val
);
Parametry
_Right
Odwołanie element, którego wartość ma być przypisana do bit._Val
Wartość logiczna ma być przypisany do bit.
Wartość zwracana
Wartość logiczna wyznaczone lub określonych.
Przykład
// vector_bool_ref_op_assign.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
class MyAlloc{};
int main( )
{
using namespace std;
typedef vector<bool> boolvector;
boolvector v;
bool b1, b2;
v.push_back( false );
v.push_back( true );
boolvector::reference ref1 = v.at( 0 );
boolvector::reference ref2 = v.at( 1 );
b1 = ref1;
b2 = ref2;
cout << "The initial value of the 1st element was: " << b1 << endl;
cout << "The initial value of the 2nd element was: " << b2 << endl;
ref2.operator=( ref1 );
b2 = ref2;
cout << "The value of the 2nd element is now: " << b2 << endl;
ref1.operator=( true );
b1 = bool( ref1 );
cout << "The value of the 1st element is now: " << b1 << endl;
}
Wymagania
Nagłówek: <vector>
Obszar nazw: std