operator<<,>>(std::bitset)
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, class Traits, size_t N> std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, |
(1) | |
template <class CharT, class Traits, size_t N> std::basic_istream<CharT, Traits>& operator>>(std::basic_istream<CharT, Traits>& is, |
(2) | |
Inserisce o estratti di un bitset da un flusso di caratteri.
1) Original:
Inserts or extracts a bitset from a character stream.
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.
Scrive il
2) x
bitset alla os
flusso di caratteri.Original:
Writes the bitset
x
to the character stream os
.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.
Estratti fino a caratteri
N
da is
e memorizza i caratteri del x
bitset.Original:
Extracts up to
N
characters from is
and stores the characters in the bitset x
.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.
I caratteri vengono estratti fino a quando
Original:
Characters are extracted until either
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.
-
N
caratteri sono stati letti,Original:N
characters have been read,The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - end-of-file avviene in
is
, oOriginal:end-of-file occurs inis
, orThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - il carattere successivo non è né
is.widen('0')
néis.widen('1')
.Original:the next character is neitheris.widen('0')
noris.widen('1')
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se non i caratteri vengono estratti,
is.setstate(ios_base::failbit)
si chiama.Original:
If no characters are extracted,
is.setstate(ios_base::failbit)
is called.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
os | - | flusso di caratteri in cui scrivere
Original: the character stream to write to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
is | - | flusso di caratteri da leggere
Original: the character stream to read from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
x | - | l'bitset per essere letto o scritto
Original: the bitset to be read or written 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
Il flusso di caratteri che è stata operata, ad esempio
os
o is
.Original:
The character stream that was operated on, e.g.
os
or is
.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 <bitset> #include <iostream> #include <sstream> int main() { std::string bit_string = "001101"; std::istringstream bit_stream(bit_string); std::bitset<3> b1; bit_stream >> b1; std::cout << b1 << '\n'; std::bitset<8> b2; bit_stream >> b2; std::cout << b2 << '\n'; }
Output:
001 00000101
[modifica] Vedi anche
esegue spostamento a sinistra binario e spostamento a destra Original: performs binary shift left and shift right The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |