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. |
<metanoindex/>
<tbody> </tbody> template< class CharT, class Traits, class Allocator > std::basic_string<CharT,Traits,Allocator> to_string() const; template< class CharT = char, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT> > std::basic_string<CharT,Traits,Allocator> to_string(CharT zero = CharT(’0’), CharT one = CharT(’1’)) const; |
(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-1th) 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-1th) 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.
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. |
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.
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
Vedi anche
restituisce una rappresentazione intera unsigned long dei datiOriginal: returns an unsigned long integer representation of the dataThe 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) |