operator==,!=(std::bitset)
Da cppreference.com.
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
bool operator==(const bitset<N>& rhs ); | (1) | |
bool operator!=(const bitset<N>& rhs ); | (2) | |
Restituisce true se tutti i bit in
2) *this
e rhs
sono uguali.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.
Restituisce true se uno dei bit in
*this
e rhs
non sono uguali.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.
[modifica]Parametri
rhs | - | bitset da confrontare 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. |
[modifica]Valore di ritorno
1)true se il valore di ogni bit in
2) *this
uguale al valore del bit corrispondente rhs
, altrimenti 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 se
, altrimenti 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.
[modifica]Esempio
Confronta due bitset per determinare se sono identici:
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.
#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';}
Output:
b1 == b2: 1 b1 == b3: 0 b1 != b3: 1