std::bitset::to_ulong
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. |
unsigned long to_ulong() const |
||
Converte il contenuto del bitset in un numero intero 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.
Il primo bit del bitset corrisponde alla cifra meno significativa del numero e l'ultimo bit corrisponde alla cifra più significativa.
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.
Indice |
[modifica] Parametri
(Nessuno)
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.
[modifica] Valore di ritorno
l'intero convertito
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.
[modifica] Eccezioni
lancia std::overflow_error se il valore non può essere rappresentato in 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.
[modifica] Esempio
#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'; } }
Output:
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
[modifica] Vedi anche
restituisce una rappresentazione in forma di stringa dei dati 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. (metodo pubblico) | |
(C++11) |
restituisce una rappresentazione intera unsigned long long dei dati 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. (metodo pubblico) |