operator==,!=(std::bitset)
De cppreference.com
![]() | Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate. La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
bool operator==(const bitset<N>& rhs ); | (1) | |
bool operator!=(const bitset<N>& rhs ); | (2) | |
Devuelve verdadero si todos los bits en
2) *this
y rhs
son iguales .Original:
Returns true if all of the bits in
*this
and rhs
are equal.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Devuelve true si cualquiera de los bits en
*this
y rhs
no son iguales .Original:
Returns true if any of the bits in
*this
and rhs
are not equal.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar]Parámetros
rhs | - | BitSet para comparar Original: bitset to compare The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[editar]Valor de retorno
1)true si el valor de cada bit en
2) *this
es igual al valor del bit correspondiente en rhs
, de lo contrario falseOriginal:
true if the value of each bit in
*this
equals the value of the corresponding bit in rhs
, otherwise falseThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
true si
, de lo contrario falseOriginal:
true if
, otherwise falseThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar]Ejemplo
Comparar dos bitsets para determinar si son idénticos:
Original:
Compare two bitsets to determine if they are identical:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Ejecuta este código
#include <iostream>#include <bitset> int main(){std::bitset<4> b1(3);// [0,0,1,1]std::bitset<4> b2(b1);std::bitset<4> b3(4);// [0,1,0,0] std::cout<<"b1 == b2: "<<(b1 == b2)<<'\n';std::cout<<"b1 == b3: "<<(b1 == b3)<<'\n';std::cout<<"b1 != b3: "<<(b1 != b3)<<'\n';}
Salida:
b1 == b2: 1 b1 == b3: 0 b1 != b3: 1