std::bitset::to_string
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. |
template< class CharT, | (fino al c++11) (dal C++11) | |
Converte il contenuto del bitset in una stringa. Utilizza
zero
per rappresentare i bit con valore di false e one
per rappresentare i bit con valore di true.Original:
Converts the contents of the bitset to a string. Uses
zero
to represent bits with value of false and one
to represent bits with value of 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.
La stringa risultante contiene caratteri
N
con il primo carattere corrisponde all'ultima (N-1
th) bit e l'ultimo carattere corrispondente al primo bit.Original:
The resulting string contains
N
characters with the first character corresponds to the last (N-1
th) bit and the last character corresponding to the first bit.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
zero | - | carattere da utilizzare per rappresentare false Original: character to use to represent false The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
one | - | carattere da utilizzare per rappresentare true Original: character to use to represent true 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
la stringa convertita
Original:
the converted string
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(42);std::cout<< b.to_string()<<'\n'<< b.to_string('*')<<'\n'<< b.to_string('O', 'X')<<'\n';}
Output:
00101010 **1*1*1* OOXOXOXO
[modifica]Vedi anche
restituisce una rappresentazione intera unsignedlong dei dati Original: returns an unsignedlong 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) | |
(C++11) | restituisce una rappresentazione intera unsignedlonglong dei dati Original: returns an unsignedlonglong 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) |