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. |
<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; |
(avant C++11) (depuis C++11) |
|
Convertit le contenu de la bitset une chane.
zero utilise pour reprsenter bits avec la valeur de false et one pour reprsenter 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 chane rsultante contient des caractres
N avec le premier caractre correspond la dernire (N-1th) bit et le dernier caractre correspondant au premier 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.
Paramtres
| zero | - | caractre utiliser pour
false reprsenter 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 | - | caractre utiliser pour
true reprsenter 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. |
Retourne la valeur
la chane 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.
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';
}
Rsultat :
00101010
**1*1*1*
OOXOXOXO
Voir aussi
renvoie une reprsentation entire unsigned long des donnesOriginal: 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. (fonction membre publique) | |
(C++11) |
renvoie une reprsentation entire unsigned long long des donnes 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) |