std::bitset::to_string
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, |
(bis C + +11) (seit C++11) |
|
Konvertiert den Inhalt der bitset in einen String. Verwendet
zero
um Bits mit dem Wert false vertreten und one
zu repräsentieren Bits mit dem Wert der 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.
Das erhaltene Zeichenfolge enthält
N
Zeichen mit den ersten Zeichen entspricht dem letzten (N-1
th) Bit und dem letzten Zeichen, die dem ersten 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.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
zero | - | Zeichen verwenden, um false darstellen
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 | - | Zeichen verwenden, um true darstellen
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. |
[Bearbeiten] Rückgabewert
Der konvertierte String
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.
[Bearbeiten] Beispiel
#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
[Bearbeiten] Siehe auch
gibt eine unsigned long Integerdarstellung der Daten Original: returns an unsigned 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. (öffentliche Elementfunktion) | |
(C++11) |
gibt eine unsigned long long Integerdarstellung der Daten 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. (öffentliche Elementfunktion) |