Sdílet prostřednictvím


bitset::to_string

Převede objekt bitset řetězce.

template<class CharType, class Traits, class Alloc>
   basic_string<CharType, Traits, Alloc> to_string ( ) const;

Vrácená hodnota

Pokud je bit odstavení nemá objekt string a třídy basic_string, kde každý nastaven bit v bitset 1 odpovídající znaku a znak 0.

Příklad

// bitset_to_string.cpp
// compile with: /EHsc
#include <bitset>
#include <iostream>
#include <string>

int main( )
{
   using namespace std;

   bitset<5> b1 ( 7 );

   cout << "The ordered set of bits in the bitset<5> b1( 7 )"
        << "\n that was generated by the number 7 is: ( "
        << b1 << " )" << endl;

   string s1;
   s1 =  b1.template to_string<char, 
   char_traits<char>, allocator<char> >( );
   cout << "The string returned from the bitset b1"
        << "\n by the member function to_string( ) is: "
        << s1 << "." << endl;
}
  

Požadavky

Záhlaví: <bitset>

Obor názvů: std

Viz také

Referenční dokumentace

bitset Class