std::bitset::to_string
De 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, |
(avant C++11) (depuis C++11) |
|
Convertit le contenu de la bitset à une chaîne.
zero
utilise pour représenter bits avec la valeur de false et one
pour représenter bits avec la valeur de 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 chaîne résultante contient des caractères
N
avec le premier caractère correspond à la dernière (N-1
th) bit et le dernier caractère correspondant au premier 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.
Sommaire |
[modifier] Paramètres
zero | - | caractère à utiliser pour false représenter
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 | - | caractère à utiliser pour true représenter
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. |
[modifier] Retourne la valeur
la chaîne convertie
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.
[modifier] Exemple
#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'; }
Résultat :
00101010 **1*1*1* OOXOXOXO
[modifier] Voir aussi
renvoie une représentation entière unsigned long des données 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. (fonction membre publique) | |
(C++11) |
renvoie une représentation entière unsigned long long des données 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. (fonction membre publique) |