std::bitset::to_string

Da cppreference.com.
< cpp‎ | utility‎ | bitset

 
 
Utilità libreria
Tipo di supporto (basic types, RTTI, type traits)
Gestione della memoria dinamica
La gestione degli errori
Programma di utilità
Funzioni variadic
Data e ora
Funzione oggetti
initializer_list(C++11)
bitset
hash(C++11)
Gli operatori relazionali
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Coppie e tuple
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Swap, in avanti e spostare
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
std::bitset
Membri tipi
Original:
Member types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::reference
Membri funzioni
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::bitset
bitset::operator==
bitset::operator!=
Elemento accesso
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::operator[]
bitset::test
bitset::all
bitset::any
bitset::none
(C++11)

 
bitset::count
Capacità
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::size
Modificatori
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::operator&=
bitset::operator|=
bitset::operator^=
bitset::operator~
bitset::operator<<=
bitset::operator>>=
bitset::operator<<
bitset::operator>>
bitset::set
bitset::reset
bitset::flip
Conversioni
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::to_string
bitset::to_ulong
bitset::to_ullong(C++11)
Non membri funzioni
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator&
operator|
operator^
operator<<
operator>>
Helper classi
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::hash(C++11)
 
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;
(fino al c++11)



(dal C++11)
Converte il contenuto del bitset in una stringa. Utilizza zero per rappresentare i bit con valore di false e one per rappresentare i bit con valore di 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.
La stringa risultante contiene caratteri N con il primo carattere corrisponde all'ultima (N-1th) bit e l'ultimo carattere corrispondente al primo 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.

Indice

[modifica]Parametri

zero -
carattere da utilizzare per rappresentare false
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 -
carattere da utilizzare per rappresentare true
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.

[modifica]Valore di ritorno

la stringa convertita
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.

[modifica]Esempio

#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

[modifica]Vedi anche

restituisce una rappresentazione intera unsignedlong dei dati
Original:
returns an unsignedlong 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.

(metodo pubblico)[modifica]
(C++11)
restituisce una rappresentazione intera unsignedlonglong dei dati
Original:
returns an unsignedlonglong 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.

(metodo pubblico)[modifica]
close