std::bitset::to_ulong
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í. |
unsigned long to_ulong() const |
||
Convierte el contenido de la bitset a un número entero
unsigned long . Original:
Converts the contents of the bitset to an
unsigned long integer. 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.
El primer bit de la bitset corresponde al dígito menos significativo del número y el último bit se corresponde con el dígito más significativo .
Original:
The first bit of the bitset corresponds to the least significant digit of the number and the last bit corresponds to the most significant digit.
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
(Ninguno)
Original:
(none)
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.
Valor de retorno
el entero convertido
Original:
the converted integer
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.
Excepciones
lanza std::overflow_error si el valor no se puede representar en
unsigned long .Original:
throws std::overflow_error if the value can not be represented in
unsigned long.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()
{
for (unsigned long i = 0; i < 10; ++i) {
std::bitset<5> b(i);
std::bitset<5> b_inverted = ~b;
std::cout << i << '\t';
std::cout << b << '\t';
std::cout << b_inverted << '\t';
std::cout << b_inverted.to_ulong() << '\n';
}
}
Salida:
0 00000 11111 31
1 00001 11110 30
2 00010 11101 29
3 00011 11100 28
4 00100 11011 27
5 00101 11010 26
6 00110 11001 25
7 00111 11000 24
8 01000 10111 23
9 01001 10110 22
Ver también
devuelve una representación de cadena de los datos Original: returns a string representation of the data The 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) | |
(C++11) |
devuelve una representación entera unsigned long long de los datos Original: returns an unsigned long long integer representation of the data The 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) |