std::bitset::set
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
bitset<N>& set(); |
(1) | |
bitset<N>& set( size_t pos, bool value = true ); |
(2) | |
Establece todos los bits a
true o al valor especificado .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)
Establece todos los bits 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)
Establece el bit en la posición
pos al value valor .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.
Parámetros
| pos | - | la posición de la broca para ajustar
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 | - | el valor para establecer el 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. |
Valor de retorno
*this
Excepciones
1)
2)
lanza std::out_of_range
pos si no se corresponde con una posición válida dentro de la 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.
Ejemplo
Ejecuta este código
#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';
}
Salida:
10101010
Ver también
establece bits 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. (función miembro pública) | |
| Alterna entre los valores de los bits (función miembro pública) |