operator==,!=(std::bitset)
De cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
bool operator==( const bitset<N>& rhs ); |
(1) | |
bool operator!=( const bitset<N>& rhs ); |
(2) | |
Renvoie true si tous les bits dans
2) *this
et rhs
sont égaux .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.
Renvoie true si l'un des bits dans
*this
et rhs
ne sont pas égaux .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.
[modifier] Paramètres
rhs | - | BitSet à comparer
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. |
[modifier] Retourne la valeur
1)true si la valeur de chaque bit dans
2) *this
égale à la valeur du bit correspondant dans rhs
, autrement 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
, sinon 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.
[modifier] Exemple
Comparer deux bitsets afin de déterminer s'ils sont identiques:
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'; }
Résultat :
b1 == b2: 1 b1 == b3: 0 b1 != b3: 1