std::bitset::set
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. |
<metanoindex/>
<tbody> </tbody> bitset<N>& set(); |
(1) | |
bitset<N>& set( size_t pos, bool value = true ); |
(2) | |
Règle tous les bits à
true ou à la valeur spécifiée .Original:
Sets all bits to
true or to specified value.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.
1)
Règle tous les bits à
trueOriginal:
Sets all bits to
trueThe 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.
2)
Définit le bit à
pos position à l'value valeur .Original:
Sets the bit at position
pos to the value value.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.
Paramètres
| pos | - | la position du bit à définir
Original: the position of the bit to set The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| value | - | la valeur à définir le bit d'
Original: the value to set the bit to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Retourne la valeur
*this
Exceptions
1)
2)
jette std::out_of_range si
pos ne correspond pas à une position valable dans le bitset .Original:
throws std::out_of_range if
pos does not correspond to a valid position within the bitset.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.
Exemple
#include <iostream>
#include <bitset>
int main()
{
std::bitset<8> b;
for (size_t i = 1; i < b.size(); i += 2) {
b.set(i);
}
std::cout << b << '\n';
}
Résultat :
10101010
Voir aussi
définit les bits à falseOriginal: sets bits to falseThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
alterner les valeurs de bits Original: toggles the values of bits The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |