operator<<,>>(std::bitset)
Aus cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
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) | |
Inserts oder Auszüge a bitset von einem Charakter-Stream .
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.
Schreibt die bitset
2) x
dem Charakter Stream os
.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.
Saugt bis zu
N
Zeichen aus is
und speichert die Zeichen in der bitset x
.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.
Zeichen werden bis entweder extrahiert
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
Zeichen gelesen wurdenOriginal: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. - Ende-der-Datei auftritt
is
oderOriginal: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. - das nächste Zeichen ist weder
is.widen('0')
nochis.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.
Wenn keine Zeichen extrahiert werden, wird
is.setstate(ios_base::failbit)
genannt .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.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
os | - | den Charakter Stream zu schreiben
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 | - | den Charakter Stream zu lesen
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 | - | die bitset gelesen oder geschrieben werden
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. |
[Bearbeiten] Rückgabewert
Die Charakter-Stream, die auf, z. B. betrieben wurde
os
oder 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.
[Bearbeiten] Beispiel
#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
[Bearbeiten] Siehe auch
führt binäre Verschiebung nach links und rechts schieben 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. (öffentliche Elementfunktion) |