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. |
bitset<N>& set(); | (1) | |
bitset<N>& set( size_t pos, bool value =true); | (2) | |
Imposta tutti i bit a true o al valore specificato.
1) 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.
Imposta tutti i bit a true
2) Original:
Sets all bits to true
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.
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.
Indice |
[modifica]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. |
[modifica]Valore di ritorno
*this
[modifica]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.
[modifica]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
[modifica]Vedi anche
imposta i bit a false Original: sets bits to false The 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) |