std::bitset::set
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. |
<metanoindex/>
<tbody> </tbody> bitset<N>& set(); |
(1) | |
bitset<N>& set( size_t pos, bool value = true ); |
(2) | |
Imposta tutti i bit a
true o al valore specificato.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)
Imposta tutti i bit a
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)
Consente di impostare il bit in posizione
pos al value valore.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.
Parametri
| pos | - | la posizione del bit da impostare
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 | - | il valore da impostare il bit
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. |
Valore di ritorno
*this
Eccezioni
1)
2)
lancia std::out_of_range se
pos non corrisponde a una posizione valida all'interno del 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.
Esempio
#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';
}
Output:
10101010
Vedi anche
imposta i bit a 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. (metodo pubblico) | |
alterna i valori di bit 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. (metodo pubblico) | |